I’m not sure that religions started out based on a common good. When the concept of religion was being formed, the ideas of benefit and harm were very different then we have today. Harm was death by illness, starvation, injury, and benefit was…simply the absence of harm. To live to 5 was a blessing, to 30 a miracle.
It’s taken us several million years to get to a point where there is such a thing as benefit defined as something more than the absence of pain, but we’re still wired to process the world in these pain/notpain terms. Cognitively, we overweight negative stimuli (be it physical injury or social slight) vs. positive stimuli (praise, success, joy, even orgasm).
The world was already killing people through the usual methods. Additionally, people were killing each other as well, through the usual methods and for the usual reasons (either you wanted something and you killed for it, or someone else killed for something you wanted and you wanted it back). Shared resources and community living created a need to temper this behavior for the common good, but let’s not confuse the first steps toward the state monopoly on violence for virtue. Community rules started out as a way to minimize blowback from naturally occurring violence among community members, and to temper naturally occurring ingroup violence by targeting outsiders for attack/violence/taking. Religion merely augmented this by adding a service component; now you were no longer serving your community by killing outsider or not killing insiders, you were serving Baal or Loki or your ancestors or the house of Atreus.
God was the first “countrymen,” the first “stockholders.” the first “customers,” the first call to action, the first rhetorical flourish. Before God, there was “we.” But “we” was real and confirmable, and could possibly disagree with you in your quest for your neighbor’s bedpartner. God, unconfirmable, absent, silent, inviolate and uninvokable, the accidental child of a humanity that discovered pain before joy, became the excuse we shared for our inevitable crimes against our fellow man in service to our perceived injustices.
And so it continues, from father to son, mother to daughter, until we hold our joy with equal weight to our sorrow, and eventually turn away from pain and toward joy, and discount pain as accident and joy as deserved. It is through joy that we can let go of God, and embrace joy as the first principle of the next society.