This is not an example of natural selection....it is an example of natural selection gone wrong. Moths evolved to fly at night by using celestial objects as guides: Keep the light source in a certain position and you can navigate, much as we do with a compass which points north. Dawkins notes that it was not until comparatively late in evolutionary history that there was anything like artificial lights to throw off the moths. We see only the moths who get distracted by the flames. We do not see millions of moths who merrily go on their way without self-immolating themselves.
So, what is the Darwinian answer to religion? Dawkins sees it this way.
My specific hypothesis is about children. More than any other species we survive by the accumulated experience of previous generations and that experience needs to be passed on to children for their protection and well-being. Theoretically, children might learn from personal experience not to go too near a cliff-edge, not to eat untried red berries, not to swim in crocodile-infested waters. But, to say the least, there will be a selective advantage to child brains that possess the rule of thumb: believe, without question, whatever your grown-ups tell you. Obey your parents; obey the tribal elders, especially when they adopt a solemn, minatory tone. Trust your elders without question. This is a generally valuable rule for a child. But, as with the moths, it can go wrong.
Dawkins then continues:
Natural selection builds child brains with a tendency to believe whatever their parents and tribal elders tell them. Such trusting obedience is valuable for survival: the analogue of steering by the moon for a moth. But the flip side of trusting obedience is slavish gullibility. The inevitable by-produce is vulnerability to infection by mind viruses. For excellent reasons related to Darwinian survival, child brains need to trust parents and elders whom parents tell them to trust. An automatic consequence is that the truster has no way of distinguishing good advice from bad. The child cannot know that "Don't paddle in the crocodile-infested Limpopo" is good advice but "You must sacrifice a goat at the time of the full moon, otherwise the rains will fail" is at best a waste of time and goats. Both admonitions sound equally trustworthy. Both come from a respected source and are delivered with a solemn earnestness that commands respect and demands obedience.
The Jesuit maxim "Give me the child until he is seven and I will give you the man" clearly understand the net result of this principle.