I've been debugging this some more and it's only partially broken, but not in the way I thought.
I fundamentally misunderstood the way that -r works here (adding extra realms by collecting other arguments); the line I pointed to actually makes sense.
And it actually works... as long as you don't specify a -w.
Passing -w causes the parent to fork, and each child to rerun through initialize_realms, which ends up parsing argv again.
But it uses getopt(): the children will have optind > 1, so they will never see the arguments.