There are two interpretations of that scene. The first, and the one generally accepted these days, is that she was off her rocker, and made a statement that stated there was discrimination against her because of what group she belonged to (ie, women), thus explaining her own failings.
Unfortunately, that wasn't the original meaning. The original intent of that scene was that she was speaking the absolute truth: Starfleet didn't allow women in command.
This was confirmed by Nimoy and Shatner in a conversation with the authors of Shatner's 1979 biography Where No Man...
"What is easier for me to deal with on that particular script is the
knowledge that the writer was making a script in which his goal was to
prove, quote, 'That women, although they claim equality, cannot really
do things as well as, under certain circumstances, as a man -- like
the command function, for example. And it was a rather chauvinistic,
clumsy handling of an interesting question. What he set out to prove
was that this lady, given command of the ship, would blow it. That’s
really what the script was about. Just that simple. You see."
"Yeah," Bill agrees. “The problems were solved without really --"
Leonard cuts in, nodding. "That’s, what I was dealing with when we
were shooting that show -- the knowledge that that was the concept.
And I rebelled against the concept. I was uncomfortable doing the
whole show because I didn’t believe in the concept."
Roddenberry later admitted the line was sexist and said he regretted it. However, it was very much in keeping for him. Roddenberry's original story was even worse.
At the time he was going through a nasty divorce, and had a low opinion of women in general--and there are many reports of the time of the crap he said, including statements like "...all women are c***s who can't be trusted" (said several times at story meetings). It's reliably reported that, even putting the divorce aside, he was absurdly sexist even for the time.
You can see the same sort of thing earlier, in the original pilot "The Cage" (later re-used in "The Menagerie") when Christopher Pike makes a statement about being uncomfortable with the idea of a woman on the bridge, which then causes the bit between him and Number One about not considering her as a woman.
Incidentally, the reason Majel Barrett was dropped from the role, contrary to Roddenberry's later statements, had nothing to do with the studio/network being uncomfortable with a woman being second in command, as he claimed. What they had a problem with wasn't an actress playing the part, they had a problem with an actress then having an affair with Roddenberry playing the part, as they were nervous about the potential backstage drama that could result. But anyway...
So, long answer short, yes, the line and backstory was intended to be absolutely as sexist as it appears: Lester is justifiably bitter that as competent as she otherwise was, she could never command a starship because Starfleet didn't want women putting cooties all over their captain's seats.
However, even at the time it was recognized just how offensive that idea was, and it grew even more unacceptable, so by the time the 1980s rolled around and Star Trek IV showed the captain of USS Saratoga was a woman, it was firmly understood the idea was stupid, and everyone proceeded to ignore it. So, gradually, the contorted explanation that no, Janice Lester was just crazy and Good Ol' Gene wasn't a misogynistic ass became the accepted one. Christopher Pike, when he showed up on Discovery, didn't have any sort of issue with women in senior positions (even reporting directly to one), Starfleet had female captains right from the early days, and there was never a ban on women in the Big Chair.
Edit
Here is a clip from the trial scene in ST4. The (unnamed) Starfleet officer has an admiral's insignia, and there may have been others in that scene (I didn't check it all). One wonders if someone working on the movie wasn't making a point.
