Religion is not necessary to defeat a dystopia. It is a good way to rally people behind one central figure and use that to sway the masses onto your side but overall it is not a need when trying to win. There is not a straightforward way to defeat a dystopia usually they are societies that have become so broken beyond repair that fixing it is impossible. Religion has been a way that gives people hope, hope is a central factor in rebellion, if people believe that their prayers will be answered, that there will be a light at the end of the tunnel they will get behind whatever flag that can promise that. Religion can be used both ways in a dystopia, it can be used to cause a dystopia and it can be used to fight against a dystopia, it really all depends on how the people in charge use it. Religion is not the key determining factor but it does provide additional health, if I were to describe it in game terms it would be like the $0.99 add on in a game that makes the game a bit easier, now the game is not a complete walkthrough because you have the add on but it is slightly easier than what it was before. That is how religion is in a dystopia, depending on how it is used, everyone can benefit greatly or they can be turned into brainless zombies who follow a questionable doctrine. For example, in the novel 1984, the government has complete control over everything that everyone does at all times of the day, if religion were added to it the government would most likely try to find a way to control more people with religious doctrines such as putting the deity people worship on the outside of government buildings or building a large church saying you can tell all your sins here without fear of consequence when really they use the church as a way to get to more people and invade their privacies even more.
In the fight against oppression, religion has been seen in the past as a way for people to escape their trouble to have a group of people with the same beliefs in who they can confide in. It also gives them a safe space to pray and with prayer comes hope because which people follow no matter how dark things may seem. There are a few religious figures that have been in charge when fighting oppression( such as Dr.Marting Luther King Jr.), people look toward them to follow the doctrine they preach and if they follow that doctrine then more likely than not they will be spearheads in the battle against oppression but this is not always the case, a good majority of the time religion plays a part in the oppression with people creating laws based not on human rights but what they feel that the God they follow would want, it leads to the oppression and ostracation of certain groups of people. At the end of the day, religion is what people make it out to be, how it is used and how it affects others varies depending on the circumstances.