So, how does dogma protect us from the unconscious? This is complicated, and I haven't worked out a complete explanation, but these are my thoughts on it.

Prescription

First off, dogma provides prescriptions for various circumstances in life. We might say prescriptions - recipes for life that must be taken at face value - are a defining trait of dogma. Prescriptions provide a list of explicit steps that we can engage consciously, one after the other, saving us the time-consuming and potentially dangerous task of communicating with our unconscious in the act of exploration.

I remember when I was in my late teens and I embraced a libertarian philosophy in something like the style of Ayn Rand. It was remarkable how easily I could assign responsibility and resolve moral ambiguities with that mindset. Did I violate your rights? If not, it's on you to deal with it. Your emotions are your responsibility, not mine. And so forth. Every question answered in a flash. This was not just easy, it was empowering. I could make decisions with ease and confidence, since the possible ways a decision could be wrong were finite, knowable, and easy to check. The reduction in stress and the time saved were benefits that arguably outweighed the cost of sometimes making wrong decisions; that is, decisions that were seen to be wrong from a more mature point of view. I can only imagine how much more empowering my dogma would have been if it had the approbation of my social circles, as one would find in a religious community.

Moral exploration is costly, but how is it dangerous? Our sense of what is moral might shift, and we could discover that we are not the good people we thought we were. We may discover that the parts of us we hold most dear are in fact monstrous. Worse, a new morality can appear evil, and perhaps grotesque, from the standpoint of our current one, so that by adopting it we become "evil" ourselves. As horrified as we are when we imagine encountering monsters, it is nothing compared to the worst horror of all: that of becoming a monster.

Projection

A dogma cannot give us prescriptions for every circumstance, though. The unknown unknown is an inevitable part of our existence. To offer comprehensive protection, the dogma must go beyond prescriptions. Another technique of protection it offers us is the externalization of undesired unconscious forces, i.e. the Shadow. A concrete example, taken from Jung, is that of the elder family man who becomes enamored with a young red-head and runs off with her, recklessly destroying his marriage and alienating his children. If he'd been asked ahead of time (or afterward) if he'd like to give up his marriage for a fling with a young paramour, he would surely have refused. Thus, it's clear that his motivations arose from the Shadow. A thoroughgoing dogma, like Europe had in the Middle Ages, would allow him to externalize the aberrant desire. "She's a witch, and put a spell on me." This is known as projection. In this case, it has the added benefit of protecting him from punishment, but that's not always how it works. People practiced self-flagellation under that same dogma, projecting their sin - aspects of the Shadow they cannot control - onto their flesh, and ritually attacking it.

Protection from ignorance

Jung's notion of the unconscious contained an ambiguity. He saw the unconscious as the set of phenomena of which we were not conscious, but could be. Does that refer only to phenomena within us, or does it include external phenomena of which we are as yet ignorant? It's a difficult question, because it requires us to define "internal" and "external" from a psychological perspective, and there's no obvious way to do that. You might want to say that internal things must occur in one's brain, but that reduction doesn't match how the mind works. The philosopher Andy Clark argues that the brain is merely one piece of "cognitive technology" used by the mind. Other such tools include paper and pen, photographs, the placement of objects in one's home, the positions of one's hands, algorithms running in a computer, and even the brains of other people. All of these things can store or process information which can be accessed by various means (reading, looking, talking), and can be integrated seamlessly into the thought process, conscious or unconscious. When asked at a talk what it was that was using these tools, Clark responded, "It's tools all the way down." I believe this comports with Jung's view of the mind's relationship to the world.

When Jung says that dogma protects us from the unconscious, then, he doesn't just mean it turns our attention away from the demons within. It also covers our eyes to the threats posed by our ignorance of the world. Germs were unknown in the medieval period, but the dogma tells us pestilence is the result of sin, either of the populace or of the king, and we already know we can externalize sin and "deal" with it. Foreign ideas or practices, to the extent that they contradict our own, may be dismissed as the work of the devil. Importantly, this has the knock-on effect of keeping us unconscious of the falsehood of the dogma. Falsifying evidence is explained away.

More difficult than the falsifying evidence are the contradictions within the dogma. Contradictions are inevitable, since dogmas are optimized for psychological defense and not for truth or logic. The user of dogma must practice sustained cognitive dissonance. God loves us, yet he will send most of us to Hell, where we will be in agony for all eternity. While it's true that you may love someone and yet subject them to corrective punishment, you clearly cannot love someone and subject them to eternal, irrevocable punishment. Believers often sustain this contradiction by changing the logical definition of the word "love" to allow for God's wrath, while keeping the emotional associations with the word; then shifting back to the old definition as soon as the uncomfortable contradiction is out of sight. This is one of the many forms of irrationality the dogmatic use to maintain their beliefs. Anyone who's tried to debate such a person would recognize a long list of such things. They work because the relief from discomfort that the dogma offers is more motivating than the desire to be consistent or intellectually honest.

To the extent that a dogma can fully insulate the user from confrontation with the Shadow, it is essentially invulnerable. This is maybe one reason why arguing doesn't work. Argument is a direct appeal to the conscious mind, and, as such, the dogma is already fully prepared against it.