No changes to ChainImpl or any related classes (review with git diff --color-moved=dimmed_zebra)
Also remove unused includes.
This is a partial backport of core#20494
https://github.com/bitcoin/bitcoin/pull/20494/commits/2a26771d8161d30be1853a35acfee588cce03634
Depends on D12746