Agreed and a little caveat (at least from some legal experts and what not) is that there are people who say suicide is not illegal, it has been decriminalized, but what they really mean by that is that you can't be charged with a crime by just merely attempting suicide itself or planning it (unless you did something illegal during the commission or acquisition of the tools/method), but what they did NOT ever say is the civil consequences, such as but not limited to: being involuntarily hospitalized, committed against your will, detained and forced treatment, then being financially charged (billed) with treatment that you never consented nor agreed to, losing your civil rights (especially firearm ownership and possession), having a mental health record that will show up on background checks, affecting your future professional life/career, and last but not least, social consequences such as stigma and ruined social relationships (people treating you differently, losing friendships, and etc.). I despise anyone who tells me otherwise, tries to downplay, whitewash, or condone the mental health system as they are clueless or blatantly ignorant of all the (possible) consequences of prohibition of suicide. Hell, in fact, I believe the way we treat suicidal people are worse than we treat suspected criminals. At least suspected criminals have the right to remain silent, get a lawyer (even a shitty public defender), and afforded due process.
So in a sense, suicide might not be illegal in the sense of committing a crime, but the consequences of a failed attempted or plan for suicide is just as bad that it is de-facto illegal.