This makes it harder to pass nullptr and cause issues such as
https://github.com/bitcoin/bitcoin/commit/dde7ac5c704688c8a9af29bd07e5ae8114824ce7
https://github.com/bitcoin/bitcoin/pull/29021/commits/fa5989d514d246e56977c528b2dd2abe6dc8efcc
refactor: Mark IsBlockPruned const
Member fields are used read-only in this method.
https://github.com/bitcoin/bitcoin/pull/30428/commits/aaaa3323f37526862ebf2a2a4bf522c661e6976e
This is a partial backport of core#29021 and core#30428
Depends on D18256