That's not true, or not entirely true.
True life example from a law firm I worked with. Needless to say, their gender pay gap was bad because their partners were dominated by men. And of course, on the surface, the reason was that the men worked longer hours, on higher profile matters, and didn't take maternity leave etc ... so sad, but <throws up hands> not the law firm's fault, it's a societal issue blah blah blah blah blah.
But then they took a closer look at things. And surprise surprise, what they found was that the reason men were working the longer hours on better cases wasn't just because the men didn't have as many caring responsibilities or because the men were happy to do it when the women weren't. A BIG part of the reason was because the best work, the most juicy work, the most high profile work, the work that led to the most profit for the law firm.... was being allocated by all those male partners to male associates. And the less interesting, less juicy, less hour-intensive work was being allocated to the women. So the women were doing fewer hours even when young and they were doign less interesting work so weren't as motivated etc etc etc.
So then they implemented an automated work allocation process that did not involve a HUMAN making the decision - based on skills, experience, time availability etc. And what happened? a) many of th epractice areas got very angry and the senior (male) partners refused to use it because they didn't get the assocites they liked and b) when the practice areas DID use it, suddenly, the gap between men and women in hours worked and work on the interesting cases became a lot more even.
Another example. Performance reviews. Pay, bonuses and promotions are based on performance reviews. But, when they looked at it, men, overall, were getting higher performance reviews. Why was that. Shock horror, they looked at what was happenin ginside those performance reviews. And all the old cliches "she lacks gravitas" etc were on display. HR Director pointed out that, overall, the curve for the male and female associates should be the same. And insisted they figure out how to fix it.
These are all the sorts of embedded sexism that exist in firms that drive the gender pay gap. it's way to simplistic to say it's the fact that women take maternity leave and work fewer hours.
Look at the retail sector. Dominated by women at the lower level and YET almost always, it's men at the top? I don't believe that if there are 10 women and 1 man that man always is the one working the long hours while the women are all taking part time work for caring responsibilities. Bullshit.