This is about right. The linked study may not be very good, but the hypothesis is plausible.
I'm a nonbeliever with a (very smart) manic-depressive sibling, and said sibling has done way better during periods of religious belief than during periods of unbelief.
Putting aside ontological questions, religions give you an automatic community. You can find a church or equivalent, with people who will listen to you and help you and take you seriously. You also get texts/legends/liturgy that give you ways to think about stuff. There's also a lot to be said for ritual itself, for daily and weekly practice.
As I get older I'm less ready to assume that people who don't think like me are *complete* idiots.