Cleanup received_new_header calculation to use WITH_LOCK
Summary:
This is a partial backport of core#25454
https://github.com/bitcoin/bitcoin/pull/25454/commits/ffe87db247b19ffb8bfba329c5dd0be39ef5a53f
Depends on D14910
Test Plan: ninja all check-all
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Differential Revision: https://reviews.bitcoinabc.org/D14911