I feel for your experience. To note, as a field we've long been one of the worst when it comes to depression and mental health (from the top of my head, we're par with teachers ?)
It was brutal before any glimpse of remote work, open offices didn't help in any way.
Some saw remote work as a way out of the quagmire, others like you had it worse.
PS: participation in local communities would benefit both the lonely people and the community.