[META] This commit should be followed up by removing the comments and
assertions meant only to show that the change is correct.
This is a backport of [[https://github.com/bitcoin/bitcoin/pull/20749 | core#20749]] [10/17]
https://github.com/bitcoin/bitcoin/pull/20749/commits/9c300cc8b3ce3d82874982fbf3087e48a6ac0ef2
Depends on D11180