That's not actually true though is it, suicide is illegal in many jurisdictions. Not just self- euthanisation towards the end of life anyway (which is more controversial/media-discussed) but any form.
The context of that comment is a parent comment asking about medical self experimentation. You're also not allowed to administer scheduled substances to yourself in many jurisdictions and plenty of other things like that but that's not what I was replying to.
To give the authorities a reason to intervene. Which in turn is justified by most people who fail to commit suicide being happy, in retrospect, that they failed.
There's probably also a crowd who want it to be illegal because they view suicide as a sin, though personally I think that justification for a law seems like a violation of religious freedoms.
> Which in turn is justified by most people who fail to commit suicide being happy, in retrospect, that they failed.
If true, that sounds like survivorship bias (literally). Those who aren't happy about the failure will just try again and won't be counted in the statistics.