It's massively individual isn't it? Some are mentally ill, some aren't.
What about the people who get found out for a horrible crime and take their life to avoid being held accountable? I don't think many people would have a problem labelling that as selfish.
And sometimes mental illness can be selfish. Not in a blamey 'I don't care about anyone but me' way, but in the sense that it can leave the person trapped in a dark swirl of only their own experience and thoughts and unable to see the impact it has on others. Doesn't mean it's their fault at all, but an illness of that sort can end up being very self centred in the literal sense of the word.
Suicide can also be a way of sparing others of, say, looking after you when you know it will take over their life and be a burden. Of the face of it, not selfish. But what about an elderly person who persuades a relative to help them commit suicide so they don't have to suffer, but knowingly leaves that relative in trouble with the law, maybe in prison, as a result.
Suicide isn't one path, it's just one end point. It's way to simplistic to say that it categorically is or isn't a selfish act, it depends. There can even be elements of both selfish and unselfish thoughts/behaviour in any one suicide, just like any other choice in life. The trouble with this one is it's final and can't be come back from.
OP, I'm sorry that you're in such a rough place though. I hope you can find some help and peace 