This is a backport of core#19289 [2/3] https://github.com/bitcoin/bitcoin/pull/19289/commits/d8441f30ff57e4ae98cff6694c995eaffc19c51a
Depends on D10095
ninja all check-all
@bot build-tsan