Was he ever diganosed with a mental illiness? Was he ever committed to a mental institution? Have any of his friends,neighbors, or coworkers come foreward to say they saw things in his behavior that suggested to them he had mental problems? If the answer to one or more of these is yes then mental health should be part of the discussion if not then it would seem bringing it up is just a way to deflect from the fact another radical Islamic terrorist was able to pull of an attack.
His ex wife said he was abusive
So yes he should have been reported as either a complaint or charges and received counseling. He could have been screened at that point.
But if domestic issues of abuse are suppressed as commonplace culture, and with the rejection and suppression of gay interests he may have had, he and his family did not seek or get the counseling for these issues that could have led to screening for deeper mental or criminal level illness.
The layers and layers of suppression and rejection out of fear of being confronted and outed make the hostility build and escalate until this erupts in chaos or violence as here.
He was likely a time bomb waiting to go off. The perfect target for recruiting. Mentally imbalanced ppl seeking to attack or abuse ppl or govt for a sense of power they get out of it.