Maybe it's just how things are done. It has nothing to do with sexism, rather it has a lot to do with organisation. It's more organised than everyone rushing out at once. The teacher has grouped the class into the two most obvious groups to avoid a rush (and possibly someone getting injured). If this teacher grouped the class differently, say, people that have their birthday from January to June, then is that discriminatory? No. It's just how things work. Get over it.