For one thing, the social role of a Church seems overstated in my experience, though that might depend on denomination. After sitting through the sermon and that business was done, what followed was merely lunch / dinner with extended family. We never mingled much with others.
Religious families are big on family and I this day and age, they're smaller than ever. Gone are the days, in my case, of communing for a large family dinner almost every week. I barely even see my parents.
All of which to say I think our social needs were met in large part by family, and Church was a convenient vehicle to bring it together. There's no substitute for family. However, between a plethora of possible social obligations given our leisure time, I think loneliness can be abated.