Ugh okay. Let's start here. What's your definition of gender? While you're at it, what's your definition of sex? Bonus points for explaining why my definition of gender is nonsensical.
As for a man becoming a woman because he puts on a dress, that’s the implication of this argument, no?:
“But then behaviours and roles started getting adopted by women in such pervasive numbers that they became associated with the word “woman” exclusively, such that women could be identified by these things,”
I mean, sure, it doesn’t have to be a dress, but what behaviours were you referring to? Things like having breasts, wider hips, finer bone structure, smaller hands and feet, not having an Adam’s apple, these aren’t behaviours or roles, they’re anatomical features that, in combination, are extremely strongly correlated with being female.
Yes, you can mimic them with hormone treatment and plastic surgery, yes, somebody might mistake you for a female if you’re a male who exhibits them, the fact that mistakes are possible doesn’t render the entire category moot.