Personally, I don’t think it’s a matter of “deserves” or not; you shouldn’t summarily execute* someone once they’re hoers de combat, no matter what they’ve done. Cozy very likely would’ve surrendered if they had explicitly asked her instead of turning her to stone, based on her terrified look as she was petrified, and even if she hadn’t, she was no threat in her state.
But if it is about deserving…then why wasn’t Starlight turned to stone? She actually killed people in alternate timelines, by the millions.
*People will say “petrification isn’t execution”, and sure, she’s not technically dead, but if it’s really forever, as stated to be the intention, then it’s worse than death assuming ponies have an afterlife, as Discord in Season 3 explicitly indicated he was aware while petrified (he overheard Celestia talking before being unpetrified).
Being able to see and hear, but unable to move, as ponies come and laugh at you and birds crap on you (birds were shown in the newspaper atop the statues in the epilog) is pretty horrifying, essentially taking being put in stocks and making it eternal punishment, which makes a swift execution seem merciful by comparison. It’s some consolation the three might have internal telepathy with each other in the statue, but even then, they might just devolve into bickering for thousands of years of misery.
Now, maybe it’s only temporary, but if that’s the case, they’ve just made sure the three will be a threat to the future together, when if Cozy had been kept unpetrified, then she would’ve died of old age likely before Tirek and Chrysalis get out…
Finally, you may say her petrification isn’t with awareness, which would defeat the idea Discord had for it, but sure, let’s consider it…this would mean if it’s forever that it’s a cessation of existence…which is the same as death without an afterlife. Only if the petrification is sans-awareness and with an end is it preferable to death, but that goes against what’s stated.
As to the initial imprisonment in Tartarus, it basically had the same problem: trialless punishment of a child with life imprisonment with minimal social contact that would likely drive such insane.
Both instances of punishment are violations of Articles 5 and 10 of the Universal Declaration of Human Rights.