Interesting topic, generally speaking, about biblical stories copying older pagan beliefs. Many pagan communities were pagan, only to become closer to the divine. They knew [at least,] that there was more to know spiritually than they knew so they would try to gain a knowledge of divinity, but had not received these types of revelations. They could have stumbled upon or had been taught truths during their journeys.
Remember the saying -even a broken clock is right twice a day