This is a backport of core#21244 [2/8]
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 core#19806.
Depends on D10749