It was just a coincidence.
Vargo Hoat had made a deal in which he brought Robett Glover's men into the dungeons, with the goal being to loose them later to take the castle. When Arya frees them; both their condition and Glover's comments indicate they were not just prisoners:
Once freed, the captives stripped the dead guards of their weapons and
darted up the steps with steel in hand. Their fellows crowded after
them, bare-handed. They went swiftly, and with scarcely a word. None
of them seemed quite so badly wounded as they had when Vargo Hoat
marched them through the gates of Harrenhal. "This of the soup, that
was clever," the man Glover was saying. "I did not expect that. Was
it Lord Hoat's idea?"
Arya, Jaqen, Rorge, and Biter luckily enough are therefore in a position to switch to the winning side:
"Who are you men?" A crease appeared between Robett Glover's brows.
"You were not with Hoat when he came to Lord Bolton's encampment. Are
you of the brave companions?"
Rorge wiped the snot off his chin with the back of his hand. "We are now."
The "...now" indicates that Rorge (et al) are taking advantage of the situation to switch to the winning side. And note that the backstory is clarified there - "with Hoat when he came to Lord Bolton" helps indicate how this came about.
And Jaqen makes sure that Arya (and the reader) fully understand:
...Jaqen H'ghar knelt beside Arya. "A girl does not understand?"
"Yes I do," she said, though she didn't, not truly.
The Lorathi must
have seen it on her face. "A goat has no loyalty. Soon a wolf banner
is raised here, I think...."
There's no indication in any of this that Jaqen had any advance information - recall, he only participated because Arya effectively threatened his life. However, Jaqen seems to catch on to what's happening faster and more smoothly than the others - perhaps because a man sees, perhaps because he's always composed.