I don't think that would work. Judi & Mikayla could meet after Mikayla changed, and they'd be to all the world a lesbian couple. But under your proposed language they'd be a legal marriage.
I think the problem is that biological reality doesn't provide the bright, easy line we wish it would. So any legal definition that tries to both enforce a bright, unambiguous line and to deny gay marriage will necessarily grind up those people who are born living too close to the line. (Whether plain gender dysphoric, or physically intersexed, or that TLA someone mentioned upstream that I'm too lazy to look up right now, etc. :-)
"I think the problem is that biological reality doesn't provide the bright, easy line we wish it would."
That is a really succinct summary of the issue. Biology is a lot more complex than commonly thought.
I don't see how a lesbian couple could get married under the language I proposed, especially in the case where one got sex reassignment.
Of course the language I proposed was thrown together in a minute as I was typing and would need more rework, but basically anyone who ever had their sex reassigned would become ineligible for marriage (or instantly nullify any pre-existing marriage.)
Thus a freely made decision would make impossible certain future decisions, which is often the case in the course of human events, e.g. I don't work for a private company during my career so I don't get Social Security.
The only case brought up by punster that would seem to create a quandary is AIS where the person from all outward appearances appears to be a woman but is genetically a male, and where it seems in most cases the person identifies as a woman.
If the definition of male and female is genetic then this person would have to identify as a male and marry a woman and create a situation which would look very much like a lesbian marriage. I don't know the answer to this. Off the top of my head, any person with AIS would be required to go through what would appear to be a sex reassignment regimen to look more like the male that he/she is before being allowed to be married. But this seems rather draconian and fascistic on the face of it.