Before:
```
wallet_resendwallettransactions.py | ✓ Passed | 14 s
wallet_resendwallettransactions.py | ✓ Passed | 7 s
wallet_resendwallettransactions.py | ✓ Passed | 9 s
```
After
```
wallet_resendwallettransactions.py | ✓ Passed | 3 s
wallet_resendwallettransactions.py | ✓ Passed | 4 s
wallet_resendwallettransactions.py | ✓ Passed | 6 s
```
Also fixes [[https://github.com/bitcoin/bitcoin/pull/20143 | core#20143]]
This is a backport of [[https://github.com/bitcoin/bitcoin/pull/20112 | core#20112]]