I think religion is finding itself without a chair at the table in many realms of human discourse.
Theocracies always have the option of acting like "The Solar Temple and Jim Jones cult(s)"- prematurely ending their members tenure on the planet.
The wrest of us have to worry about anthropogenous and non-man made extra-planetary events like planet Nibiru causing pole shifts on earth when it's 3,600 year orbit brings it closest to our sun. Asteroid strikes and the ultimate fried crispy- our own sun exhausting it's fuel and becoming a red giant star (not in our lifetime) also make it important to spend our time in ways that are meaningful to us.
If as in the old Planet of the Apes trilogy- we end up worshiping the bomb.... that may fray things further. However, we would first have to forget technology is our collective tool. This would be the job of the High Priests like in the beginning of the movie "The 5th Element". The scientists would be poisoned by "clergy" so that the
"secret" would be safe.
I would go so far as to say that religion is on it's way out. Slowly but surely, the world is secularising. I realize that this sounds like a ridiculous statement with the pervasive Islamic and Christian fundamentalism in the world (especially with the recent attacks in India), but there is a strong trend that economic growth and stability result in more secular societies.
This does not mean that they won't destroy the world before their gone though.
All I know (which I don't know much) is that the most influential religion in the world, Christianity, is loosing the battle. In a vacuum, some other religion will replace it. Fortunately, this would not mean the end of humanity but the beginning of more idiocy.
Wide and vast religious communities, devided by blood, will probably contribute to the beginning of a new dark age, if it were to come again. I do not believe religion alone will be the end of all things human. "Cleansing of the race," maybe, but probably not the entire race. Ultimately, people are responsible for what will happen, short of worldwide natural disaster. I often wonder if another "Fall of Rome" is on its way. Another dark age where fear rules, and where fear is religion. It'll take more than just religion to reach such a point. The fall of the natural enviroment will probably have us backed into a pretty tight corner as a race. Scary to think about. A world that's too hard to live in to have any time to think, and religion will once again rule. I too believe that religious influence on those who would otherwise follow their own beliefs is coming to an end, however slowly. I would like to see the day where free thinking and religious freedom is simply the norm.
Religion is a man-made construct. To presume it holds some power over humanity that is "beyond" humanities capabilities is to give it a sort of supernatural power. Religion is not, and cannot be blamed. WE created it. We are to blame.
Religion, like many other idealogies is just a tool used by some to gain something that they need, wether it be power and control(survival of the fittest), or comfort and security(survival).
The problems of this planet as a result of humanity are complex. Religion is just a symptom.
Humans, will be the reason humans fail. As an athiest, I simply cannot blame anything else. .... well except maybe a comet or something :P Otherwise I would have to believe in a power with direction and thought that is greater than humanity.
I tend to think that those who are following ideologies that purport some end of the world / rapture / what-have-you do have a power over those same followers. They believe the divinity of the words and commands they follow and so yield to it. So it becomes self-fulfilling. Why stop climate change if God is going to bring the rapture? It might as well then be supernatural because to them it REALLY is. Humans may have invented religion but that doesn't mean we aren't powerless to stop it now. Can you get out of handcuffs without a key or tool?
Destructive and restrictive ideologies must be abandoned and filled by ones that replace superstition with investigation and that replace faith with philosophy.