Local primaries should be preferred to relocating primaries

To reproduce the bug use -Dtests.seed=5AB62524C9AB0489
Fixes #4237