The Sontarans are a stereotypically warlike race. They see everything in the context of warmaking. Even wishing someone well (which is a peaceful action) often references wishing they will have a glorious battle.
They love war. They're not just angry or aggressive. In fact, they can be very courteous to people, even ones they dislike (I remember Strax telling someone that he was happy to expect a glorious battle, and he said so with honest kindness).
Out of universe, the Sontaran "pro male" attitude can be argued to be a continuation of their incessant military attitude. Their character resembles that of an alpha male. It helps paint the picture, and creates some comedy as the Sontaran ideas are outdated human ideas. Less than 200 years ago, many men shared the exact same opinion that the Sontarans show today.
In universe, this can be argued as the Sontaran interpretation of gender roles in function of military aptitude.
Though Strax is shown to be incapable of telling a man from a woman, he does understand that they are different.
But given their military single-minded nature, when a Sontaran contemplates the difference between a man and a woman, his interests will boil down to one question:
Who is the most efficient soldier?
If you describe the biological difference between men and women, what would you say?
Women are, on average, shorter and less physically strong than men. They also get pregnant, which renders them physically weaker (in regard to combat prowess).
While shortness is not an issue for a Sontaran (as they are rather short themselves), physical strength seems to be very important to them, as their bodies seem to be designed specifically to withstand a lot of physical pressure.
This is reflected in your examples. I'll add his assumed thoughts to his statements:
A pity. Words are the weapons of womenfolk, who are not strong enough to use their fists. I must judge you unfit.
Good work for a female, who I would have expected to be useless to us in this war. Now she must be protected.
Edit
"Good [military] work for a female" is equivalent to "fast running for a handicapped person".
It considers being female as a handicap that obviously lowers the expected quality of the outcome; but the Sontaran still acknowledge that this is a better result than expected given that they are so handicapped to begin with.
Although I will repeat myself here, let me answer your questions directly:
How did the Sontarans come to develop their sexist mentality?
They see the world as one big military war. Everything is judged in the face of military prowess.
Why do they have such a low view of women if there are no female (or male) Sontarans?
Women are ill-suited for combat; which is the most important trait to a Sontaran.
Was this a view which emerged over time based on their observations of other species?
There are two options, in my opinion:
(1) It's possible that the Sontaran objectively looked at the biological differences between men and women, and they themselves decided to consider women inferior, based on their (objectively measurable) lower combat prowess compared to men.
Keep in mind that the Sontarans are simpletons, they do not understand anything but military prowess.
(2) It's possible that Sontarans merely adopted human gender stereotypes, as they felt connected to human soldiers (because they are soldiers), but can also be considered to be the stereotypical alpha male that promotes gender inequality.
I am stereotyping military personnel here; but the Sontarans are comical stereotypes too. Take this with a grain of salt please, the Sontarans are meant as a comical diversion, not a serious statement about the inferiority of the female gender.
Edit A slightly more elaborate answer to the comment below.
Do not forget that the Sontarans are simpletons. We can argue that stereotypically female traits can have benefits too (e.g. diplomacy, espionage, ...), but this discussion far surpasses the cognitive capacities of a Sontaran mind.
The Sontarans cannot evaluate something that they are incapable of understanding in the first place.
The Doctor says so himself:
Two genders is a bit further than he can count.
This doesn't just state that they only know one gender. It also takes a stab at the Sontaran's lower intelligence, suggesting that they are incapable of counting to two.
Please do note that the Doctor is not literally saying that Sontarans can't count to two. It's a tongue-in-cheek overstatement, not meant to be factually correct.