Moves code for header verification out of main, to consensus.
EDIT:
Partially replaces #7310, only for the header verification part.
Like in core_io.h we can separate the cpp files instead of using a single consensus.cpp.
Continues #8329
It’s analogous to #8329 but with the functions necessary for VerifyHeader().