refactor: move first run detection to client code
Summary:
This is a partial backport of core#20773
https://github.com/bitcoin/bitcoin/pull/20773/commits/e2a47ce08528dfb39c0340145c6977f6afd587f6
Test Plan: ninja all check-all
Reviewers: #bitcoin_abc, roqqit
Reviewed By: #bitcoin_abc, roqqit
Subscribers: roqqit
Differential Revision: https://reviews.bitcoinabc.org/D17642