Again, extremely sexist and not fitting in the egalitarian idea of the Federation. Equal opportunity lawyers would have a field day so I don't expect it to stand (and it clearly didn't given that by the TOS film era we see a female captain).Judge as you wish, they never explained the reason for it. Maybe there was something that happened in between Disco and TOS where they decided to limit women's roles. I'm betting it was a class action lawsuit against the federation for not taking proper precautions, and their only option was to cut back.
Sexist attitudes best left behind.