This doesn't seem invalid? If for example 'wanting to spend more time at home'/'cares about team fit more than salary' is a predictor of gender, that doesn't mean it shouldn't be excluded from analysis.
What we care about is whether the pay difference is because of people treating women unfairly. If a different trait causes lower salaries in both men and women, but is more common among women, the problem is not a gender pay gap.