That’s the thought behind it being tied back to antediluvian Nephilim. All these “gods” were quite happy to be regarded as such, but weren’t. They would have been sufficiently advanced to appear to be “gods.” Ergo, the people of the various cultures didn’t just invent them, they were real. But, the sheer apparent impossibility of what was described rendered these accounts, present worldwide, as legendary or mythological or spiritual, when in fact they were just technological, but it could only be recognized as such in more recent times.
The classic Clarke quote applies here:
“Any sufficiently advanced technology is indistinguishable from magic.”