You are right, a lot of women seem to be happy getting rid of not so great jobs and stay at home with their children.
But I think it is a social problem. This means a lot of jobs offered to women are shitty because employers know they will lose them around their 30ies.
Since there is social consensus to leave after a child birth, it makes it difficult keep the woman's job but with an alternative solutions, like part time, progressively returning after the leave or going remote.
I knew couples who would have wanted to switch positions, with the man at home and the woman working. It is not impossible, but there's a lot of hurdles and there is still a social stigma associated with.
Addition:
A secundary effect of women leaving after building a family: the man in the couple has to bare all the burden. The employer knows it, and the power balance changes. This is also a reason why some couples don't want childs, or young men don't even think about marriage (they assess there is nothing good for them in the deal).
The position of women obviously shapes the whole society, and its becoming more and more a problem on a lot of very different aspects.