If you get one thing from this answer: Beware underhanded negotiation tactics. Especially with companies who inexplicably fail to retain women talent.
In particular, do not believe anything you hear in negotiation! This looks to me like a classic underhanded negotiation. Maybe I'm wrong, but you need to understand what this underhanded tactic looks like and how it may have happened in spades. I urge you to keep your defenses up. Without further ado: they really went low here.
I do have a bit more experience than the men near my level and I believe that I'm a bit more productive than them, which could partly explain my higher wage.
That seems like a fantastic reason to pay you more than your peers. It might even be discriminatory not to.
She told me that my company thinks it's valuable to have a more diverse work environment, so they were willing to pay me my requested wage, despite it being much higher than the average for this position.
So what happened is she devalued you on the basis of your gender so you believed you could not ask for more. Underhanded intent or not, that is what happened here. You may have asked too low even. And your hiring manager made it sound like a hush-hush thing, so you might not even ask for any more advice on the topic, or compare salaries (great job on not falling for that, by the way). Not the first or the last time that will ever happen to you in your career, dare I admit, especially as a woman.
It is advantageous for them to dole you nonsense like this because it frames the negotiation so that they have total power in valuing your employment. You can tell this because you have, of course, never considered that they are not paying you enough for the diversity you are adding with your own womanhood. It should be an obnoxious red flag to you that they get to value your diversity but you do not. Beware underhanded negotiation tactics.
This is the sort of vague, ploying nonsense that happens in a negotiation, and, of course, it should be very, very odd to you they have so much trouble retaining female talent. Their excuses and weird compensatory tactic to make up for it are probably part of the very problem. But, if the work culture seems extremely positive to you, and you are pretty confident your compensation is estimable, then it may be worth not taking this point too seriously.
Gender-informed hiring and negotiation is often a great thing. But it was definitely wrong to use your gender to make you question your value.
Your management either did something very lowbrow, or something innocent and stupid. Either way: they have deliberately put you in the position where from this day forward, your compensation has absolutely nothing to do with your performance.
At any company, it is extremely difficult for an employee to know their worth. You may make blunder after blunder and they may know the softawre system you are supposed to keep running smoothly is a piece of junk, but you have trouble telling whether you are the problem or they are. It is hard to tell what is going on. Therefore employees are extremely sensitive to any hint of their worth. Not that you need to be sensitive when they drop a bomb on you: apparently they want you to believe that a good percentage of your compensation is because of your gender.
How can you ask for a raise going forward when they forced you to believe your compensation is pure generosity anyway? Yeah, they made a huge mistake. My guess is you will not be with them very much longer.
Gender should inform pay and negotiation structure, but when it comes time to actually hire or manage an employee, it should be left out. What would be okay is to tell a woman she was hired because she accurately estimated her ability as a coder and the company values that over negotiation finesse. This may be part of an initiative to retain more women, either because the hiring manager feels this is a noble goal or because they feel women are talented and it would be in the company's best interest to retain them, but there is a difference between gender informing these decisions and gender being laid out in front of the employee as what her worth depends on. That is not okay because, moral or not, it creates a toxic culture and, honestly, is part of their retention problem. I'm not sure whether they'll ever realize that.
Perhaps I've answered your initial question by now. I think initiatives to promote and retain women are great and they should bring into question compensation and negotiations. Your company went about a way to do this that was wrong. My own business ethics would never let me do something as underhanded as this while, effectively, intimidating a woman on the basis of her gender. There are effective, respectful, and moral ways to go about retaining women and explicitly considering gender in the process, but your company is an another planet when it comes to this problem.
How to lean in: center your employment and future job searches around your performance. You deserve this. Accept nothing else.
What to do now? Firstly, a good job, no more and no less. Stick with this job and do your best. You are plenty qualified for it, as you clearly are aware.
Always recenter every conversation on your compensation on your performance. "I appreciate that you want to retain women talent, but you should be aware I'm performing very strongly here. I hope that as you have seen my talent you have only come to value that more and more." Stuff like that.
And finally, When you look for a new job, absolutely expect to make more. Do
not believe this nonsense that they overvalued or overpaid you. That's effective at suppressing salaries sometimes but in full, underhanded glory it is all but emotional abuse.