I believe it's a matter of need. People take up a religion because it helps put their fears and concerns to rest.
While there are truths you are bringing up in what you offer as an explanation, I think it doesn't entirely work in the bigger picture. To begin with I do not believe people's adopting of religion can be reduced down to existential dread (which is what I believe you are getting at in talking about fear). There is a lot more to it than that. In quite a number of cases that fear of non-existence, or death, is not the case. To cite just one example, someone having an "awakening" moment, a profound moment of facing the Void (non-existence, non-being) and coming out on the other side of it no longer have that fear. And yet, they become some of the most deeply devout. It's not fear that drive them, but rather a yearning to become everything possible, and then some.
At a high level this can be understood as the difference between what Maslow recognized in others in his research as "abundance needs" versus the typical "deficiency needs". Deficiency needs seeks to fill a need that is lacking. In your example, one might come to religion to put their fears of death at rest through beliefs. In abundance needs however, one is already fully satisfied with their lives, but there exists a need to express, communicate, and share this, to grow this, to expand this, to become fully and overflowing with that deep satisfaction. Such as these don't fit the model that religion is about death-avoidance.
Furthermore, and more importantly, religion actually does NOT "put their fears and concerns to rest". It simply does not, nor can through simple belief. Religion itself can be for many people who are consumed by that existential dread, actually be all about death-avoidance! It's a form of death-denial! "Jesus will bring me back! I will live forever!", etc, is avoiding facing non-existence. It seeks to "save" this life they live. And doing that, will never result in putting their fears to rest. Denial is not being at peace. Therefore, on a deep existential, on deep subconscious and emotional levels, since it cannot actually truly work, despite the lies we tell ourselves "just believing" in the face of annihilation, the best you could say is that these people turn to religion to try to deny death. But it's not effective in actually doing that to the point one is actually released from that fear. So the best that could be said is it provides the illusion and promise of relief, like a carrot on a stick to keep one chasing after it through the system.
But again, religion is much, much more complex than that. And the reasons why people adopt it far more than simply fear. Social identity, group cohesion, support, structure, and a long list of other reasons are also a factor. Religion and the reasons people adopt them is a whole lot more than just death-denial alone.
To do this they have to trust that what they are told is true: their beliefs are genuinely valid. Most often this means accepting the entire basis of these beliefs (one can't pick and choose which pronouncements are right and those that aren't) which can include some pretty odd stuff. It's an "In for a dime, in for a dollar" kind of commitment.
That can be part of that one particular aspect of it for some people. That's true, but that's far from an inclusive enough model to explain the rest of it very well, let alone those who don't fit that basic need, which are many.
Coupled with this is the authority for these beliefs, which is almost always a god. A figure invested with so much wisdom it can never be wrong, and which naturally begs to be followed. Sometimes quite literally.
Now this is something I talk about regularly about authority and the need to believe and trust that authority. But that fits the developmental model I was mentioning in my two previous posts. That only applies to those at that stage of growth, like a child needing to believe in and trust the god-like knowledge of his parents to keep him safe and teach him how to survive in life. That is very much the mythic-literal stage of faith, but it does not reflect the higher developmental stages. In those, like in any normal childhood development, external authorities become gradually replaced by internal integration. You become the authority in yourself. You become self-actualized, and self-realized. If all you ever do is follow others, you have not yet internalize anything, and yet matured. Any child raised by their parents should grow enough where they are now independent and responsible for themselves to make their own decisions and become a parent, an authority to another.
But alas, so much of religion keeps people at that dependency stage, especially Christianity in the West. Hence why I believe so many are breaking free from it, becoming atheist, spiritual-but-not-religious, alternative religion, etc. It's their attempts to break away from self-serving, narcissistic authoritarian parents to find themselves as self-awaking young adults, as well they should and need to! I seriously believe there is truth to this, and I could expand on it for some time.
So here's the set up: Religion doesn't work because it's rational but because it helps people get through their lives; a very important benefit that can't be found anywhere else. A benefit so important that anything that even smacks of picking at it can't be right, and may even have to be destroyed. People are so invested in their beliefs that no matter how crazy they may be their preservation is paramount.
But that's actually not true. The same things can be found in other ways than religion. But the 'cognitive dissonance" aspect of it you are talking about here, is true of anything, not simply religion, where we emotionally invest our hopes and beliefs in seeking for find whatever it is we are looking for from it, a relationship for instance.
What you see in religion where someone is say, "denying evolution" as we've been talking about, I honestly do not believe it's just cognitive dissonance going on, though I accept in certain cases that is in fact what it is. In others, such as a Ken Ham type "believer", I do not believe it actually is cognitive dissonance! I believe it's basically a cognitive incapability! That very different. Do you follow? Cognitive dissonance occurs when you "know better", but don't want to accept the data. But if you tried to explain stuff to someone without the necessary prerequisite foundations in order to understand something, it literally goes right over their heads! There is no dissonance there. It just simply escapes them. It lands outside their field of vision. It sounds like the teacher in Charlie Brown's Christmas talking, "mah mah, mah mah mah mah...."
This is a developmental thing. Even though they are biologically adults, that has nothing to do with the development of higher structures of consciousness, the frameworks we utilize for translating our experiences of reality. The rational framework, versus the mythic framework, is something that has to develop to the point it replaces the earlier stage of mythic symbols, as valid as those are at that stage, with the symbols associated with later stages. But those who aren't there yet, in that line of development, simply don't grasp that way of thinking yet. What you see then is a "disconnect" in translation between the two stages. That's not cognitive dissonance going on within the mythic level. It's actually quite consistent for that level. Ken Ham, as the example, is not contradicting his world view. He is true to it. He is not in denial of "reality" such as it is to him.
You see where this can go from here?
So the religious mind necessarily splits itself into two modes of approaching life, one using rationality---after all, it's far more beneficial to understand why A² + B² = C² than to just accept it on faith---and the other actually using faith---after all, it's far more beneficial to have faith that prayer works than trying to find a down-to-earth rationale for it before accepting it.
But this is actually not true. You do have those at the rational level who have rational understandings of their own faith and beliefs! This model only works if you reduce religion down to pre-rational mythic and magic thought. For instance, a very easy example is myself. I can talk at some length about "God" from a religious perspective which never once violates reason. It can in fact be held in a rational worldspace, without any cognitive-dissonance whatsoever. Of course, it's not going to look like the anthropomorphic sky-parent deity God of the mythic level, but that's my whole point!
And this is why I think we sometimes find very smart people believing some very irrational stuff. To dismiss the irrational stuff would be to admit the basis of their security may be flawed. Maintaining one's sense of security far outweighs one's commitment to rationality.
And this is where I say there is some truth to what you say, but it's pretty specific rather than a sweep explanation of the whole. I want to avoid getting really deep into this in all its subtle shades and variations, but at a high level, I surmise that firstly that cognitive-dissonance occurs when someone is for the most part flying at the rational level as the dominant mode of how they perceive and translate their realities. Then when some other deeply-personal, or deeply important part of their lives, such a truly deep religious need, is important enough for them to be able to integrate it with the rest of their lives you end up with an internal conflict. In many, if not most cases, people's "religious lives", are frankly not all that critical or important to them. They're able to simply fly at the mythic level when they go to church on Sunday, and then put it away like their bicycle when they are done riding it for the day. It's not important enough to them to "upgrade" it to something more effective, at the same level of quality with the other important things with the rest of the lives.
But when it is important enough, and they are predominantly operating at the rational level in the rest of their lives, then they become faced with that disconnect in their own minds with their own modes of thinking over in this other important part of their lives! Now they have a conflict. Now they have dissonance. Now they have an inconsistency, a disconnect. And all that can bring with it emotional reactions, such as irrationality, denial, excuses, alibis, etc, because they are facing quite literally a crisis of faith! That's the pain point before growth occurs!
Now they can go a few directions here when this is occurring, far too involved to go into here. But one of those is to grow that area of their lives to be consistent with the rest of how they translate their world. They can no longer afford to "think as a child". They have to mature their religious understanding of what faith is to them in their lives to be not at odds with the rest of their lives. They literally have to "evolve God", in what that is to them, to make it not at odds, where "faith and reason" are the right and left hands of their own body, both functioning at the current age they have grown to. They are now both 30-year old hands, on a 30 year old body, as opposed to a 5 year old hand on a 30 year old body. They become proportional, balanced, and fully functional at the stage.
Alright, I feel an urge to write an entire chapter of a book on this area, but I'll spare you that much reading here!
Cool stuff, and an interesting topic, to be sure!