IMO. there are two problems with linking gun control to mental health. First, diagnoses of mental health are not always clear cut. It's not like a blood test. You'll very often be able to find two mental-health professionals who have different opinions about a patient. It happens all the time in murder trials. Second, mental health isn't a constant. It can change with age, experiences, and circumstances. Watch any true-crime TV shows, like Fear Thy Neighbor. Some nice, normal person gets pushed beyond a breaking point, and suddenly grabs his gun and murders his neighbor. In some of these cases, the mental-health degradation goes on for months or even years yet there is no intervention.
Even if gun owners had to undergo periodic mental-health examinations, that wouldn't solve the problems of the lack of standard, unambiguous criteria for mental health, or friendly doctors who would issue passing grades like they do opioids. Furthermore, sometimes the shooter isn't the gun owner, like Adam Lanza who used his mother's guns at Sandy Hook Elementary School.
Just pouring money into the mental-health system may not bring the relief everybody wants. Likewise with anti-poverty programs. That's why society has turned to gun-control as a cheap, easy(er) fix. We need to have more sane discussions about finding better ways.