Move common sanity check code to init/common
Summary:
This is a partial backport of core#21732
https://github.com/bitcoin/bitcoin/pull/21732/commits/387c4cf5887bfdaf1606e1b287d901e4c449514f
Depends on D12559
Test Plan: ninja all check-all
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Differential Revision: https://reviews.bitcoinabc.org/D12560