This is a backport of [[https://github.com/bitcoin/bitcoin/pull/21244 | core#21244]] [28]
https://github.com/bitcoin/bitcoin/pull/21244/commits/1add318704108faa98f5b1b8e9c96d960e9d23a8
Note: due to out of order backport, I also had to remove `private:` in `setup_common.h` which is otherwise removed in [[https://github.com/bitcoin/bitcoin/pull/19806 | core#19806]].
Depends on D10749