When the first human societies formed, from small tribes to large communities, the ability to simply get on with each other would obviously be advantageous to survival. Co-operation is essential for a society that relies on hunting, farming or any other activity that is too much for one or two individuals to undertake. A community that learns to work together for the benefit of all will do much better in the face of drought, disaster, predation or attack. The basic humanistic ideals would fall into place quite quickly in any developing society. After co-operative intelligence evolves, Humanism is not very far behind.
Religions seem to serve several purposes for a society.
They help to bond the community together in ceremonies, rituals, grief, celebrations and so on. They give a divine stamp of authority to the humanist ideals. A s early societies grew, people would have grown curious about the world around them. In the days long before computers, telescopes and microscopes, there was no good way of learning about bacteria, weather patterns, earthquakes and so on. I n order to keep the society together, it becomes necessary to say that the original humanist notions are handed down from a deity.