Small correction -- members of the Church of Jesus Christ of Latter Day Saints (of which I am one) don't have to give up on caffeine. There were some people who taught and practiced that, but that is largely in the past.
Even BYU, the church-owned school, now sells fully-caffeinated Coke on campus. This was a fairly recent development.
As well, members are encouraged to avoid any media that includes sexually explicit, violent, or otherwise negative content -- not only avoiding R-rated movies. The church teaches that people should be careful about their media choices and consume media that enlightens or edifies, not just entertains. Active members of the church definitely vary in how they interpret that, of course.
I do love your point about sacrificing some things and getting a community in return. I work as a software engineer and at the age of 25 I already have two kids. My wife and I definitely sacrifice for them, but I hope we can build a loving family that will give us social returns that are lifelong. Growing up, I had a large network of cousins and siblings that were closer to me than friends were. I know much of this is because of the influence of the church.
It is also true that being a member gives you a network of people -- people are always around to help you move in and out, they're always there every Sunday, etc. Members are assigned "ministers", two people who check up on them, are officially assigned to love them, and report back to the leadership of each ward (congregation) regularly about any problems the people they minister to may have. All this in addition to the friendships that naturally form with people you see once a week.
Sacrificing alcohol, swearing, and other things -- tithing, Sundays, a two year-mission -- seems like a small trade in comparison for the creation of relationships with people who love you and who you love in return.