Making the story about an alien or trill past life is a bit of a cop out.There could have been some interesting way to approach gay and trans stories. Ezri could have been guy with a similar story to what actually aired and still hooked up with Bashir in the end. It could be interesting with male Ezri and Worf in doing the bait and switch of Worf not giving a shit about Ezri's gender but just put off that this guy reminds him so much of his dead wife. They could have just had male-male or female-female couples standing around in the background of scenes or holding hands or whatever. In the 2000s I was thinking of a story for Enterprise that probably sounds a bit like similar to parts of Lifesigns and Alter Ego in someone communicating across an alien race's planetary network through virtual reality, and it might have been Reed or Mayweather talking to some female alien but then it becomes apparent that it's actually some alien guy who felt more comfortable talking as a female and feels they identify as one. You do something with the changelings who could be a man or woman or alien or anything. Maybe old Odo from the time travel planet was a woman for part of his two hundred years. I sort of become annoyed when I hear they were at least going to give it a go in TNG season 1 with Blood and Fire, which might have been crap too, but at least someone was trying to bring something to the table, and then they sat on their hands for the next 18 years and give us slop like Prophet and Lace.
Would people feel that it would be enough just to hire a trans actor and then just never mention her transition in the show but we would all know ? Maybe you could have little things like pictures of the person as a child in their room showing them as previous gender.
I would prefer that to a trans storyline but being heterosexual I wouldn't know too much about what would be the best way to do it