That's fine for private companies, that's shareholder profit. If women are allowed to paid time off to children that's discrimination against those who choose not to, or cannot have kids.
People having kids has a societal and economic benefit though because those kids are going to go on to pay taxes and care for the current generation, that's why it's encouraged through public subsidy. Compared with the amount which a person will generally contribute to society over their lifetime paying for their mother's maternity (and father's paternity) leave is pretty small so even though I have no current desire to have any myself I can see the arguments to encourage it in general. Child allowance should be limited to perhaps the first 2-3 children though imo.