A possible explanation is that most teachers in primary school are female, which creates an environment and behavioral expectations that favor girls, e.g.:
It could be that there were other external factors that used to counter-balance this effect, and are now being removed, such as, for example, the quest for increasing female participation in STEM no matter what, or general societal norms beyond school spurred by the rise of femminism.
In any case, the academinc literature on this topic is vast (and not so clear cut), so if you really have not seen thorough investigations on the topic beyond "boys don't like it" or something from the Bible you can start by reading papers citing those I mentioned above:
Let me rephrase my complain about what I've seen. There is a lot of academic work on this stuff, but I'd characterize it as very "leaf node" oriented on certain aspects. E.g., grabbing a few at random:
That's just sort of how the modern academic system works. Specialization.
There's nothing wrong with that, but where I live it isn't turning into serious policy conversations that look at thing more broadly and with a longer view. It might in other places, but I can't speak to those.
I would love to see more of those serious conversations where I live. For instance, again specific to my experience in the US, it seems unlikely that "get more male teachers" would make a dent in a problem that started independently of primary teachers being overwhelmingly women.
I've read that even among female teachers theres a big difference in approach to misbehaving boys depending on if they had a male sibling or not. With declining fertility rates, you can imagine that being less and less common.