K. van der Toorn has a 1989 article summarizing the purity system of ancient Mesopotamia. He describes purity rules as a form of temple etiquette. What makes something unclean is not that it is immoral but that it is displeasing in a particular setting, in this case displeasing before the god.
That analogy explains a lot, and van der Toorn’s piece is a masterful summary. Toward the end, though, his argument gets bigger, more speculative, and far less convincing. He suggests that the Mesopotamian view of the gods retained an element of naivete, and never arrived at a fully transcendent view of the gods. The more transcendent the gods became, the less they became like humans, the less the analogy of ritual and etiquette worked: “Du moment que les dieux sont concus comme etant tout autres, les liens entre purete rituelle et etiquette sociale se rompent” (355; roughly, when the gods are “wholly other,” the analogy between purity and social etiquette is ruptured).
That suggests that the more transcendent a religion conceives God to be, the more the religion gets “spiritualized” and “moralized.” Rituals have less to do with access to God, since God is wholly inaccessible anyway. Rituals become purely symbolic, and ritual purity is evacuated of significance. Moral purity is all. Alternatively, “spiritualized” religions can turn rituals of purity into the very method of salvation: By purging the body as such, one ascends to the spiritual realm of God.That sort of evolutionary scheme doesn’t work. Allah is more strictly transcendent than the Triune God whose Son is incarnate among men, yet, as van der Toorn himself details, ancient rituals of purity etiquette continue to have an important role in Islam. Van der Toorn is right to see a fundamental difference between Christian-influenced religions and ancient religions, but it is not so easily fit into a progress from immanence to transcendence, or from physical to spiritual.
(Van der Toorn, “La Purete Rituelle au Proche-Orient Ancient,” Revue de l’Histoire des Religions  339-56.)