As many have said, the impact on pension can be significant, the job market is tough at the moment and although the idea now is to go back when they go to school - you'd then be looking for a job that would work with pick-ups or drop-offs and school holidays which is significantly more difficult to find in a new job than asking for flexibility in a job where you have already paid your dues and proven yourself.
What happens a lot is that women who have taken a year or two off, then can't find a job flexible enough to work around school and pay the same salary so it's still "not worth" it to work and the year or two turns into several or until secondary school. Also, in the meantime, the partner has often taken on more responsibility at work/taken on more hours and it makes it even less "worth it" for them to ask for flexibility and cut hours, so the woman is then also looking for a job that allows pick ups and drop offs and school holidays, and in the meantime the partner gets another promotion etc. etc. ... Without anyone meaning it, one of the couple gets stuck.
If there is any way to request a sabbatical, compress schedules, drop a day etc. I would definitely consider that before quitting entirely.
Also if you ask on money matters on here or the Money Saving Expert forum, you could probably get a good idea of exactly how much not working for a couple of years not working would actually cost you over your lifetime - better to take a decision with all the information as I agree, it's really hard when you're not feeling the benefit now!
Not all of the gender pay gap is caused by maternity leave and childcare BUT it does have a massive impact - if you're looking at losing 300,000 in earnings over your lifetime as a man with the same career and qualifications, it might motivate you to push on through such a difficult time for you!
From https://ifs.org.uk/sites/default/files/output_url_files/BN223.pdf :
"By the time the first-born child is aged 20, the difference in average hourly wages between men and women is about 30%. Of that gap, around one quarter already existed when the first child arrived. Of the remaining three quarters, around half is due to factors other than differences in rates of parttime and full-time paid employment after childbirth. Previous research suggests those other factors could include women being less likely to work in more productive firms, less likely to successfully bargain for higher wages within a given firm, and more likely to enter family-friendly occupations over high-paying ones."
https://equalitytrust.org.uk/news/press-release/calling-all-women-calculate-your-potential-lifetime-earnings-loss/
Older article, but showing that you may well end up earning 300,000 less over your lifetime (that figure doesn't include the effect on pensions):
https://www.theguardian.com/world/2019/oct/28/women-paid-less-than-men-over-careers-gender-pay-gap-report#:~:text=%E2%80%9CWomen%20aged%2026%20to%2035,the%20ONS%20said%20on%20Monday.