This is an excellent question. As you noticed, i-PI tries hard to assign the same replica ID to the same client, if at all possible, precisely because this often allows for faster electronic structure calculations.
I can see two ways around this. One is to make your "hack" clean - which would mean implementing a third "matching mode": as you can see around line 200 in inputs/forcefields.py, you can specify matching="any"
that just picks the first client available, and "auto" (which is default) that tries to match and only falls back if no client is available.
You could have a "match" mode that stops the calculation if it can't match replicas, but I fear it will be tricky to make this failproof: the whole idea in the client assignment code was to make it robust to hangups
of the clients.
The other possibility is similar to what is implemented in quantum Espresso: the driver side checks the replica ID, and if the replica is not the same, it restarts the calculation from scratch, paying the price of re-initializing
the density/wavefunction. This usually gives you the most resilient setup, although at the price of running a more expensive calculation every now and then.
Hope this helps. If you want to follow the i-PI feature route, I suggest we move the discussion to github, as this gets to be more of a feature request than something that can be solved on the user side.
Michele