It's a bit clearer and restricts the scope of fLoaded
This is a partial backport of [[https://github.com/bitcoin/bitcoin/pull/22564 | core#22564]]
https://github.com/bitcoin/bitcoin/pull/22564/commits/fe96a2e4bd87768df8001eb4117926a0977d876e
Depends on D13087