I remember hearing over a decade ago that when correcting for that by comparing similar jobs, the gap actually flips - women out-earn men by a very small percent (like somewhere around 2-5%).
In addition to this, men value top line salary more than women relative to other benefits like PTO, medical, commute, etc. So in many cases men are actually taking worse jobs but get counted as increasing the wage gap.
Which is mostly an artifact of bad statistics. As it is the average over all working men and women. Where men disproportionally take on dangerous but high paid jobs.