[refactor] Remove unused ForEachNodeThen() template
Summary:
This is a backport of core#21186 [5/5]
https://github.com/bitcoin/bitcoin/pull/21186/commits/0829516d1f3868c1c2ba507feee718325d81e329
Depends on D10930
Test Plan: ninja all check-all
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Differential Revision: https://reviews.bitcoinabc.org/D10931