There is no doubt that religion had already waned under the onslaught of the Enlightenment but it was Freud who provided the radically new understanding of human nature that made any religious explanation of the whats and whys of our personhood seem naive.
Consider this: I can go to Antarctica and get cash from an ATM without a glitch but should I fall ill during my travels a hospital there could not access my medical records or know what medications I am on.