A big part of establishing a “harem" or hypergamous society, which is a facet of patriarchal society, is to get rid of the boys as competition. If you can’t do it by sending them off to war, then you do it by brutalizing them to strip their confidence and self esteem or by abandoning them to fend for themselves emotionally so that they are unable to make an emotional connection with a young woman who might want them.
She’s left to choose the best financial option for herself out of the available men or do it alone because that’s all that’s left. Or to have any kind of choice stripped from her. Arranged marriages and young girls as gifts become the norm.
Here in America, you saw this dynamic in Mormon and other fundamentalist cultures.
So when you see guys like this acting abusively toward young girls, you’ll almost always find that they are simultaneously emotionally (or otherwise) brutalizing boys because those boys are competition. Teenage girls do not want obnoxious, hairy, grown men. They want their first kiss to be the boys first kiss too. Just saying.
What this teacher was doing was a minor version or adaptation of this dynamic. As much as he could get away with. Verbally berating young boys also acts to keep them from challenging predatory behavior when they know it’s wrong. It’s conditioning too.