part two ... the rational base
Suppose you are a caveman 40,000 years ago. What do you see in the sky? Well, obviously, the sun is the most important thing there is ... followed by the moon ... then the stars. Then you have the rare solar eclipse (very scary in light of the sun's preeminence), the common lunar eclipse in which the moom doesn't completely get "eaten" and then there are the interlopers ... stars that gradually move (planets) and the occasional comet and the ubiquitous tracer bullets (meteorites). There's the aurora borealis (but only if you're way up top). That's about it.
The Importance of the Sun
The sun allows you to see, warms you and even to these primitives, it "makes things grow in spring when it gets warmer". It's hot! So, without the sun, even primitive man knows he's screwed. The sun is the only thing you can't look directly at ... in all creation. It's far an away the most awesome thing. It clearly affects and effects life on earth. It is "God".
The moon on the other hand is just about as big as the sun. You can look at it. It affects things on earth, i.e. you can see at night by it (a very valuable property to man). It also might be understood to affect the tides (by coastal primitives). It, unlike the sun, changes of itself. That is, it has phases ... and it moves from one night to the next in addition to it's nightly traverse ... and it completely disappears sometimes. You can see it at the same time as the sun on some days but it is no where near as prominent in the daylight, being easily outshone by the sun. Hence, it is a lesser god ... although it occasionally "eats" the sun or part of it ... temporarily (eclipse).
The stars look like campfires in the distance. The campfires of the lesser gods. It would be an easy extrapolation to make that these lesser gods also affect the earth even though there is no objective correlation with such a supposed effect. So, astrology is born of extrapolation from objective observations ... hence, religion, which is astrology for the masses (in story book form) is born of objective observations. It's just twice corrupted ... once at the astrology error ... and twice ... from the story book rendering.
Reversing Cause and Effect
Suppose you are a coastal caveman and you've adapted your behavior over centuries to go out on the exposed tidal plain to dig for clams. Then ... if you were born into this society ... you would buy the idea that the moon (the lunar god) pulled back the water to expose the tidal plain so that the "people" could find food. That is, this moon god is your benefactor. You didn't adapt to the tides ... you have no memory of doing any adapting ... hence, the tide has been turned for you by your god.
The same is true for the more powerful sun gods. The sun makes the rainy season, etc. and if there is a drought ... the sun looks with disfavor on your tribe, i.e. cause-effect reversal. So, better make some sacrifices to the sun god so the rains will come ... or whatever is the problem.
Primitive man sacrifices because he literally doesn't have anything else to do to "speak to the gods" which to him is of import to the gods. Thus, they help man so the gods must value man ... thus, sacrifice man because it is the only thing we have that the gods value.
When the sacrifice is made and things go back to normal ... it reinforces their beliefs. When it doesn't work ... make more sacrifices. If nothing works, the culture is destroyed or dispersed and nobody is there to renounce the gods. Start over.
How do you break this cycle? The only answer I can see ... in view of the widespread still current belief in the gods ... is that humanity as a whole must become better educated and the bad things in life mostly removed. They certainly won't give up these "stories" when they have nothing to gain but uncertainty.