I would have taught it's the opposite. If women are discriminated against because of having children, I guess the companies that doesn't discriminate against women (or even actively helps them) would get all the good ones?
This is true only for irrational discrimination. If you simply hate women, but women are equally productive to men, then you will lose out on getting good women. I.e., you might choose a man of quality Q-d over a woman of quality Q simply because you dislike women.
But in this case, the discrimination is rational. Due to maternity leave, a woman of equal skill creates significant cash flow risks - if she takes leave, you either go for 3 years with her job not getting done, or else you hire a replacement and risk being stuck with unnecessary employees in 3 years.
"you hire a replacement and risk being stuck with unnecessary employees in 3 years"
That is not how it works in Sweden (nor anywhere else that I know of). The replacement is hired as a temporary position until the original employee returns.
Even if that's the case, you would most likely get an employee of lower quality or with a lower commitment if they know they will be laid off in 3 years.