This is a partial backport of core#21525
Revert commits (rABCd1b32162feaf))
https://github.com/bitcoin/bitcoin/pull/21525/commits/0c1b2bc549aec77b247f0103652d883227841ac5
https://github.com/bitcoin/bitcoin/pull/21525/commits/eede0647b06b6009080c4e536a2705e911d6ee19
https://github.com/bitcoin/bitcoin/pull/21525/commits/e62067e7bcad5a559899afff2e4a8e8b7e9f4301
Refactor commit
https://github.com/bitcoin/bitcoin/pull/21525/commits/7b8e976cd5ac78a22f1be2b2fed8562c693af5d9