On the SAT, I did better on the math than the verbal. I also did better on the math than 99% of boys or girls - and I'm a girl.
But if we assume your premise is correct, and math education is inferior because most teachers are female, how do boys still manage to learn?
First of all, no need to assume anything. The SAT data I cited above are absolutely correct & easily verifiable by Internet search.
The fact that men are better at math doesn't necessarily mean that they are also better at teaching math. Teaching involves a different set of skills. (I understand that Einstein was a poor teacher.)
Lastly, the brightest students are capable of learning more than their teachers know.....which has always been true.
Some learn in spite of their teachers and some don't learn. That's the point. Some don't learn.