refactor: Separate hash and stats calculation in coinstats
Summary:
This is a backport of core#19145 [2/3]
https://github.com/bitcoin/bitcoin/pull/19145/commits/2474645f3b15687e7f196b89eb935d6e6a98a9da
Depends on D11155
Test Plan: ninja check
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Subscribers: Fabien
Differential Revision: https://reviews.bitcoinabc.org/D11156