In an ideal world, all problems could be fixed at their source, but in practice, we shouldn't limit ourselves to only solutions that target the source of the problem. As a much simpler example, it's common and pragmatic to take painkillers to treat headaches, even though they certainly don't make any attempt at fixing the source of the headache.
Gun control (and other forms of means restriction) is effective at preventing suicides. It's not a satisfying solution (after all, the people it saves are still miserable), but it works, as indicated by many studies. That doesn't mean we shouldn't dig into why people want to kill themselves and try to fix those (like with mental health treatment or more proactively helping people maintain financial or social stability); I think we should probably take both approaches simultaneously.