The next part of that theory of mine is that with a community, you can feel good without needing to look down on others, maybe it's as simple as being too busy laughing with friends to be looking for those faults in strangers. Maybe it's knowing that no one's perfect but you like them anyway (e.g. some of your friends might have dumb views but you enjoy their company anyway and don't shun them).
So the loneliness epidemic is making assholes out of all of us.
I also think that feeling prosperous means you're friendlier to the less fortunate (e.g. refugees). Europe suffered austerity under the Merkel/Schaüble regime and they don't see themselves as prosperous, so they have bile against the people who had to abandon their properties and communities, fleeing bombs and bullets.
I wish I could find surveys to prove that idea, I just have the feeling that rich Norway is more welcoming towards refugees, compared to e.g. less rich Poland (citation needed...).