Where the Lightwoods take note of Alec’s sexuality earlier, after he had his parabatai bond with Jace but still a teenager, and decide to hire a warlock (not Magnus because I’d rather Alec be an actual adult when they meet for shipping purposes) to ~*magic*~ the gay away.
The warlock, not being a complete bastard, talks to Alec in private (because he needs specifics if the spell is to work properly and boys rarely tell the truth if they think their parents can hear, he tells the Lightwoods) and lays it out for him. There is no spell, he can wave his hands and send pretty lights and sparkles out, and Alec can go back to living in the closet to make his family proud. Or he can fool his parents for as long as he needs to to get out, and the warlock will find him a safe place to stay where people won’t try to ‘fix’ him.
Alec takes option 2 and slowly makes a name for himself with downworlders as an independent shadowhunter that truly cares (I’m thinking a Batman or Archangel-like figure that the Clave is aware of, but doesn’t really expend resources on unmasking because he helps more that he hurts them).
By the time season 1 starts he’s been dating Magnus for a year or so, has friends and connection throughout all the downworld, and has been tracking all the Valentine rumors (and relaying them to Jace and Izzy, cause let’s be honest, they would never have taken any side but Alecs).