This is a backport of core#20750 [10, 11, 12 & 13/17]
https://github.com/bitcoin/bitcoin/pull/20750/commits/229bc37b5f18cffbc85efbad3b6e9047c6951e95
https://github.com/bitcoin/bitcoin/pull/20750/commits/3704433c4f5ecf9f196860b2ccecae0d2c8b5f6e
https://github.com/bitcoin/bitcoin/pull/20750/commits/417dafc1ee07af3319c2fe89758123cb8362ff16
https://github.com/bitcoin/bitcoin/pull/20750/commits/120aaba9ac41af71a760aa0969dd090e96786fb3
Depends on D11195