Yeah, the order is determined by the placement each Gym leader gets in the Champion's Cup I believe; it's essentially a strength ranking. Milo is first because he's the weakest of the leaders, Raihan is last because he's the strongest.