I read an article today that tried to explain why people in some other cultures have such a hard time with the idea that women should be treated as equal to men. The author pointed out that until recently everyone felt that way. He compared the way women were seen in Western society in the nineteenth century to the way we see pets today, and pointed out that the idea that women should have a say in running things (like by voting) seemed as absurd to people then as suggesting we allow dogs to vote would seem to us now.
While reading I realized that the same could be said of halacha. I think a better analogy than pets is children. Halacha treats women like ten-year-olds. Like children, women are people, and we care about them. Men may love them, be concerned about them, genuinely want them to be happy, even go to great lengths to ensure they have good lives. But the idea that they can care for themselves, should have any kind of authority, or can serve on a court or as a reliable witness is absurd. We would never think of appointing a ten-year-old as a judge. That's ridiculous. And we can understand why something like having a woman lain is an embarrassment to the men present. It's just like if, today, the only person in shul who could read was an ordinary ten-year-old.
We can trust women for some things, just like you can trust a ten-year-old with some limited responsibilities. And we can praise them for attributes particular to their position, telling women that they are more spiritual and closer to God in the same way that we praise a ten-year-old's childlike innocence and fascination with things that we have become too jaded to enjoy. But ultimately, naashim daaten kalos. Children must listen to their parents for their own good. Children and parents have different roles, and for a child to act as a parent, to have equal say in making rules, to have the authority in running the house, etc. is absurd.
We don't make rules for children or keep them from adult roles because we hate them. On the contrary, it is because we love them and care about them that we restrict them to child-appropriate roles. And the framers of halacha weren't misogynistic in the way that those who now try to restrict women's roles are. They genuinely believed, as did nearly everyone throughout history, that women are ten-year-olds.
In the cultural milieu in which halacha developed, right up until a few decades ago, women were seen by the men in charge as ten-year-olds. Keep that in mind, and halacha's attitude towards women makes perfect sense.