I have recently thought about the development of religion and societies, and have come to an hypothesis: Religion helped build the early societies and let them flourish by piggybacking on secular principles of society-building.
It would seem that the primary pillars of any functional, productive society would have to be:
1) Order (each member performing their part for the betterment of the whole)
2) Trust (a society of thieves, for instance, could not exist without all of them trusting each other to not steal or kill each other)
3) Tradition/Ritual (A common cultural heritage will bind a group together)
(nb. These are the principles for a "functional, productive" society. I suppose it may be possible for a societal group to be productive or functional without some or all of these principles, but I doubt it will be both functional *AND* productive.)
I can't think of any more foundational principles that would apply to all societies. If anyone else can come up with any, please go ahead and add them to the list. Since these apply to all societies as we know them, we cannot assume these to be Judeo-Christian (or Hindu, or Buddhist) values exclusively. These are secularly true (if true at all, of course; I'm not a sociologist). Now then, it would seem that all organized religions provide all three pillars for any sufficiently-sized group of people believing in it:
1) Order - In organized religions, there is an internal hierarchy culminating in either an individual or a smaller subset of the population which control the religion. Religions also emphasize and applaud the individual submitting themselves to the needs of the group (Some call it self-sacrifice, some call it humility).
2) Trust - It would seem that all religions carry a rule or set of rules similar to the Golden Rule or the 10 Commandments (the "Thou shalt not kill" stuff)
3) Tradition/Ritual - This would seem just about obvious, but a common religion, particularly with daily or weekly communal worship requirements and/or a common scriptural heritage, will bring a large community together and enlarge the individual members' social networks.
So, we have shown how religion may be useful to establishing a functional, productive society. However, this perfect world with a perfectly homogeneous population does not exist. There are other societies, built on other religions. These societies are always in competition with each other for resources, and the society (and religion) with the least resources will usually be destroyed by the society (and religion) with the most. So now we enter the realm of game theory.
Religion A and Religion B are both functional, productive societies built around differing religions. We see the classic Prisoner's Dilemma-type situation: A can either choose to be trusting towards B or be aggressive towards B, and B has the same choice with respect to A. Clearly, if they are both cooperative, they can flourish (to a point). If they are both aggressive (assuming they are equivalent militarily), they run the risk of prolonged war and ultimately weakening their societies to the point of collapse. But if one is aggressive while the other is trusting, the aggressor stands to gain all of the resources of the other society (and before they have a chance to overexploit them, as well). Thus we see that religions that are cooperative will either be demolished early on by aggressive religions or will survive until their resources can grow no more, and will have to wage war anyways to continue flourishing. Under this model, if religions are randomly aggressive or cooperative with each other, you can expect the societies built on religions which are intolerant of other religions to flourish.
So we have now reached today's situation, in which most major religions (with the notable exception of Buddhism) being intolerant or otherwise doctrinally asserting that the other religions are "wrong". As far as Buddhism, the case may be made that Buddhism is not entirely a religion, but more a school of philosophy with some religious trappings. I do not know enough about Buddhist rituals, traditions, or structure to say for certain, I leave it up to the readers to decide for themselves.
As I mentioned earlier, I am no sociologist, but I like to think I have something of an objective mind in amateur cross-cultural studies. If you disagree with any of my points, please leave a comment and we'll work on the concept.