Sometimes I think it's said by people who are deflecting their own guilt because they couldn't, or didn't 'do' anything. Or feel either wrongly or rightly that they contributed towards it either by action or inaction.
For some of those people, looking deeper into why may be very uncomfortable, so they look to others and ask why they couldn't and didn't do more.
There's a strong sense that someone ending their life only happens because someone is mentally ill, I don't think that's quite true, as another poster has touched on. I think people can do it to escape, that escape can be from a crippling mental illness, or a physical one, or a situation they have tried and failed to change, or in the cases we see of bullying and abuse - because of someone else's actions and behaviour.
I think many of those situations do lead to mental illness, maybe the person is at risk because of 'organic' factors and a situation tips them over the edge, or like a body, a mind can only take so much before it starts to break. But I don't think everyone who does it, only does it because of mental illness.
If someone has capacity, they're allowed to make their own decisions, even if we feel that decision is wrong, I also think that in the case of mental illness, the person may well have tried to get better and as with some physical illnesses, it just doesn't happen, and what a choice that is, between suffering until you die of something physical, with no let up or relief or dying at your own hand. Sometimes they have, or they feel they have, tried everything in their power and nothing has changed.