This is a backport of core#19927 [2/6] https://github.com/bitcoin/bitcoin/pull/19927/commits/74f73c783d46b012f375d819e2cd09c792820cd5
Depends on D9820
ninja all check-all