As Luhmann argues in Theory of Society, volume 1 and elsewhere, religion always posits some mystery or secret, and occult societies (mystics, gnostics, priests, Masons, Templars, Illuminati, Theosophists, hermetic groups, etc. ) are said to have access to these mysteries, including secret texts. Only select members of a community are initiated or granted access to the occult.
So religion as a social system employs a distinction that we can characterize variously as manifest/latent, known/secret, open/occult, hidden/revealed, immanent/transcendent, exoteric/esoteric, clear/obscure, obvious/mysterious, etc. It is commonly believed, for example, that Jesus presented an easy-to-grasp message for the multitude and also imparted secret wisdom to his closest disciples. The parables can be understood on at least two levels, and Dante talked about four levels.
The assumption is that there is an outside, or something beyond everyday, given reality. In other words, there is something transcendent. But the problem or paradox is that some observer, something immanent to reality, must make the immanent/transcendent (or known/secret) distinction. This two-sided form doesn’t simply exist. An observer or observing system must make a distinction in order to indicate anything at all. Religion, as a social system, tries to dissolve this paradox by positing an Uncreated Creator or Unmoved Mover.
Religion is not necessarily about establishing or enforcing a moral code; the association between religion and morality is actually very shaky. Consider antinomianism, the idea that salvation comes through grace alone and has nothing to do with following a moral code. And some ancient cultures thought of morality in terms of valor or strength, not as being kind of generous or anything like that. Luhmann speaks of morality in terms of respect–moral action is action that is accorded respect (or esteem) rather than disrespect by a community.
God, as formulated by religion, can be thought of as the observer of everything, including itself. God, in this sense, has no blind spot. But what makes the distinction that allows this observer to indicated? The social system called religion.