I am not sure when it first came about but I can say that Archaeology and Anthropology reveal that as far back as we can see in the earliest civilizations they can find, all people everywhere sensed and knew of something that was there outside of the visible realm that as responsible for all this, that was there concerned about them, influencing them, and each civilization eventually developed cult regarding how to approach this realm (maybe even a simultaneous quantum reality if one wishes to think in these terms)...they wanted to contact this realm, seek this realm, please and appease this realm, and made prayers, rituals, oblations, and sacrifices (each of their own doing) that effected their relationship with this realm. We see things indicating this is various understandings of God, the gods, and forces, and in ornamentation, table statues, burial rites and so on and later in their writings.
So mankind is inherently religious or at least spiritual and only in the past couple of 1,000 years has soem of mankind sought to explain every aspect of reality in physical terms only. I like the approach of physicist Fritjof Capra...to get a full understanding of what it means to be human one has many avenues of exploration...the scientists is just as important as the theologians and philosopher in understanding our life and our world and neither is MORE correct and neither is MORE incorrect (except in some details). The Universe for me is Spirit and Life and matter/energy...the study and experience of each in its own place and the need for understanding of it all is who we are....
Just my $.02
Paul