Because of psychology coming into existence in the 19th century and coinciding with the rise of proto-feminists in England and the United States in the form of Women's Temperance Movements. These two forces combined to pass lots of sweeping legislation aimed at curtailing various behaviors in the name of public and moral hygiene. It wasn't just the age of consent that was implemented because of these things, it also saw a legal drinking age established, gambling outlawed, prostitution outlawed, and various other prohibitions. They also tried to get liquor outlawed as well, and eventually did succeed in the United States, though we saw how well that lasted. Just shows that you can take away the hookers, the gambling, the child brides, but if you mess with the booze, that's when people get really upset.
As to why psychology in particular is responsible, it's because prior to psychology there was no real concept of "childhood innocence" and thus people did not really think of children as being "traumatized" by things. Psychology didn't really start out with the premise that children are precious and need to be protected, rather, it merely suggested childhood years were formative, important to the healthy growth of individuals, which was of great interest to nation states who wanted to ensure moral and public hygiene. To put more plainly: in the 1800s people started to realize through scientific study that things experienced as a child can have profound lifelong impacts on adult behavior, thus to ensure public welfare some measures had to be taken by the state to ensure children were protected to prevent negative impacts on adult behavior.
But how to do this? Cue the Women's Temperence Movements who have the answer: ban whores, ban drinking, ban gambling, etc. Do it for the children! Now a far more effective rallying cry that they have SCIENCE to back it up, even though nosy god botherers like them were not a new thing in the 1800s.