As someone who went through REALLY GRUELING CLASSES (seriously, they were some of the hardest, some of the ones that made me cry, and the ones where I fucking hated the professor because he was so hard on us) on TV writing...
I get where it stands a lot of the time. And one thing was obvious with season 4 of Magicians: someone had to die. It was at "that stage" in the story. Stories have 'beats' they have to hit. A death was needed. And breaking it down, it had to be Quentin or Margot.
Penny already died once.
So did Alice, after a fashion.
Josh wouldn't have as much of an 'impact.'
Kady, even more than Q, wanted to die: she had to live to find her place in hedge society.
Julia was just rescued as part of the finale.
Elliot, they spent the whole season trying to save.
It had to be one of the two. Maybe they could've written a story in which Margot sacrificed herself to save Elliot at the end of the day, but what about the discovery she just made that she can love Josh? Also, I think the community would've been more upset to lose her.
The whole, entire cast is 'broken' in some way. It's kind of the whole point of the series. It's a book(/tv) series about broken people finding this 'reason' they're broken and coming together because of it. And a lot of them are queer or neurodivergent in some way (multiple ways in the latter, tbh).
I also found the ending... cathartic, in a sense. The way Penny talked to Q when he was struggling with that question. The way he said okay, we're gonna have to go the other route for this. Because as someone else who has been suicidal before and someone who goes through those bouts (many, many of them; in fact the vast majority of my life is spent in a constant state of it) of feeling like no one cares about me, no one would miss me, and I have utterly no impact on anyone ever... that was a powerful moment. I did not see what Q did as suicidal. Q used his power. His dinky, little, stupid specialty. The one that he felt was absolutely pointless, probably (think about it: think about how he looked at people like Alice or his rival Penny and their specialties and then he finds out oh, I have minor mending)... He used his little dorky power to save the world.
And where most people would think 'fuck yeah, I saved the world, I saved the people I cared about: it was worth it' he thought: '...maybe I only did it because I wanted to die.'
He didn't commit suicide. He was heroic, but his mental illness downplayed it. And Penny helped him see past it because Penny couldn't tell him to see past it. That's not Penny's role.
I can understand why people are hurt and upset by it, but I don't want writers to feel like they 'aren't allowed' to do anything bad to non-white-cis-straight characters. It'd be unrealistic.
Also, one thing we know: in the Magicians world, death isn't the end.
And for my part... I had really wondered how they'd use Q's power to really make an impact. It was the end of the books when it happened. And I kind of wonder if that 'ending' might still crop up. I'm excited to see.