I think it often is just as a way to reduce the numbers.
If I have arranged a birthday party for dd, now 6, I have usually invited all the class. Sometimes, I would have preferred to invite three-quarters of the class, maybe boys and girls, and exclude those who she is not close to, but I then feel it is mean not to invite everyone.
Dd went to the cinema for her last birthday and we invited only girls to keep the number low because it was without parents coming along and, anyway, would otherwise have been too expensive. I felt I should invite all the girls from the class so that none of them would feel left out, even though Dd is not close to all of them. I don't know why I feel such obligations but I remember what it felt like when I was at school and wasn't invited, so....
Maybe if I hadn't felt obliged to invite all the girls, there would have been an opportunity to invite the one or two boys dd is friends with.
I agree it is not fair that your ds is left out. It's not right and it is very likely
that it is the parents', albeit arbitrary, decision, not the birthday girl's.
There is time enough as they get older for them to have single-gender parties. And it is really nice in those first few years at school when they all play together.
I want to suggest that you perhaps have a word with some of the girls' parents but I am not sure how you could do that without it being awkward?!