Sadly the ancient Egyptians were on their way to dislodging magical thinking, and so were the ancient Greeks. It is clearly shown in the codices and manuscripts as time goes on there were less and less rituals and more and more details on human anatomy, engineering and so on. Thales and the philosophers of Ionia were the first in the Western world to attempt to explain the natural world without invoking the supernatural.
So humans were already on their way to casting off that way of thinking until the conversion of Constantine the Great. After that, he started bringing down the banhammer on heresy. Unfortunately at the time, astrology and astronomy were considered as one and the same and took the backseat until the rise of secularism under the Dutch Empire offering people refugees from the Catholic-Protestant wars.
So the groundswork was already there, just it got suppressed.
I learned all that from watching Cosmos as well.