If its to be considered at all, then mental illness severe enough should indeed be grounds to deny someone a firearm until (if ever) they are cured or proven to cope well with their mental illness.
The keys there are "severe enough" and "proven to cope." Both of those are sensible. Someone who tried to kill themselves when they were 18 shouldn't be denied a firearm at 40 after living 22 years without incident. A person with an ongoing social anxiety problem should probably not be denied a firearm, since they're unlikely to harm someone or themselves.