This is a backport of core#18991 [5/5]
https://github.com/bitcoin/bitcoin/pull/18991/commits/3bd67ba5a4ef3c20ef1f873b63c9f53a6c8608b6
Depends on D10056
Backport note: The only changes from the original PR are the removal of NODE_WITNESS from nServices and the renaming of mininode to p2p