refactor: Reduce number of SanityChecks return values and return util::Result
Summary:
This is a partial backport of core#25308
https://github.com/bitcoin/bitcoin/pull/25308/commits/6db6552377ad6316626b3ab8605a98f96f22c3d2
with changes from core#25977 applied
Previous work related to core#25308 and core#25977 (D14614 and D14992) didn't include these changes because of out-of-order backports
Depends on D17723
Test Plan: ninja all check-all
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Differential Revision: https://reviews.bitcoinabc.org/D17736