My guess is that a lot of women still do traditionally “female” jobs that don’t pay well (like teaching and caring) whereas men are more likely to go into higher paying more traditionally “male” roles in STEM and business type subjects
This is interesting.
There's also evidence which suggests that as women move into certain areas that are thought of as 'masculine' jobs, the status and pay of those jobs generally goes down.
The prime historical example is the rile of Secretary, which was, until the late 19th century, a very respected and well-paid job, done exclusively by men. With the invention of the typewriter and the increasing levels of education young women were permitted to undertake (it's still only just over 100 years since most universities starting giving women degrees for their studies) and the entry of women into the job, the job of secretary moved from high status professional to lower middle class non-professional.
In the Soviet Union, the same thing happened to medical doctors - it was a profession largely staffed by women and consequently a fairly low status, not hugely well-paid job.
The sex pay gap also works in a couple of ways: the workplace is organised around male bodies & male life patterns. Female bodies have to fit into male space, and thus pregnancy and child-rearing have to be made invisible - which is impossible, so it's felt right" that women take the hit. That's one aspect of the sex pay gap - women's incomes start lower (feminine socialisation, not demanding etc) and go even lower with children. Married women are regarded with a certain amount of suspicion in the workplace
On the other hand, when men marry, there's a lot of evidence to suggest that their salaries go up - it's called the "marriage bonus." A married man is seen as more stable, more ambitious because he wants to provide for his family. In contrast to a married woman, who's seen as less stable, less ambitious, because she wants to care for her family.
And that's before we get to the unconscious bias which penalises women twice: firstly, in setting pay levels lower for women, and then responding negatively when women try to negotiate (Oh dear, this woman is behaving in a very unfeminine way ...)
None of this is deliberate - these are socialised, conditioned reflexes.