Even asking about pregnancy/child plans in a interview is illegal.
Employers factor in that risk in their employee payment budget, build up reserves for it in accounting (same as they do with people falling sick or having regular PTO), in some cases governments step in and subsidize wages and that's it.
Employers as a class in general will not ever hand away such things voluntarily, they had to be fought for violently over a hundred years ago in collective action.
It is somewhat annoying for the employer to "lose" the employee for a year but there is ample notice (eight months or so :) ) so the employer can prepare for the absence.
Should be obvious, but somehow is not. Even if you make laws like "the employer cannot ask about ...", well, they cannot ask, but they can still make a guess, right? (And then make up an excuse, because guessing is also illegal, of course.) Instead, if the maternity leave is paid by the state, the employer does not bear the cost, the mother doesn't have to worry about the employer going out of business during her pregnancy, etc.
Generally, as a rule of thumb, if the "society wants" something, it should be paid by taxes, not thrown as an additional burden of the employers. That way, employers are incentivized to try to avoid the extra costs by doing things that are socially wrong, and the employees are not dependent of having a good and wealthy employer, and even the unemployed can get the same benefits by the same channels.
For example, if you want to prevent crime, you don't say "the employers should provide police to protect their employees", but instead you pay the police from taxes, and leave the employers out of it. Exactly the same logic applies to health care, parental leave, etc.
This way as someone who interviews people it doesn't matter if they are men or women, you know that some will have children, some won't, but we will cope when they are away. And they will be back again. Far far more of our men and women return to work and stay with the company after having children than the UK average. I haven't personally benefitted from this (I had my kids when at another company with just 2 week paternity leave) but it makes me happy to see colleagues able to use this time to grow close to their child and also return to work rested and happy.
We also have great flexibility in working patterns that has only increased since the pandemic. Happy humans deliver great work.
Caveat: I’m still learning German, and this is a second-hand description from a coworker who is a father but isn’t an employment lawyer