Poverty and illteracy are really not the reasons people flock to Religion.
Wealth, health and literacy aren't causing to people to flock to religion either. The opposite, in fact. (I have numbers to prove this, would you like to see them?)
So what is it? All I can think of is that in the absense of socio-economic or cultural factors, then fear or mental instability are causing people to flock to religion, if indeed people are flocking to religion. What else could it be?