Original PR message was "test: Fix intermittent timeout in p2p_permissions.py" but the impact is larger than this, notably rpc_net.py.
Pull request description:
The sync is based on `bytesrecv_per_msg["verack"]`. However, the bytes are counted before processing the message, so they are not sufficient to ensure the connection is fully up.
Backport of core#26854
Depends on D17530