Not sure but I believe the use of gender as a grammatical term (e.g.: in German, whether a noun takes a male, female or neuter article - der, die or das IIRC) precedes any other use.  I am not arguing with using it regarding how one feels about one's identity and I prefer it NOT be used as a synonym for sex  (let the squeamish squirm).