I also removed all the includes that are now flagged as unused by my IDE in the source file.
This is a partial backport of [[https://github.com/bitcoin/bitcoin/pull/23381 | core#23381]]
https://github.com/bitcoin/bitcoin/pull/23381/commits/68763783658f004efd9117fa7a69b0e271c4eaaa
Depends on D12360