I think these stories were written by someone other then the Jews or Hebrews. Maybe the simaritians or Greeks or some other group that didn’t like the Jews and their gods. I have read that the Greeks were known for writing a history of their family group to try and make themselves seem greater or more special as a family then they really were.
It seems to me that someone that had access to several writings took aspects of these writings whether from Egypt or Mesopotamia or Greece and took parts of these stories to make a new Israelite story. One could ask why did one of the Greek kings Philadelphious take 72 scholars in Alexandria and have them write the Greek Septuagint bible if that’s really what happened? why would a Greek care about Jewish writings and religious ideas if they were in fact their ideas.
The whole thing is very suspect and some say the story was all made up. I think the whole story of the Israelites/Jews in the Bible was made up taking real events and mashing them up with mythology and some real events to make it appear as if it was real. Maybe Philadelphious was trying to make up a new race of people for himself neither Greek or Egyptian.
Anyway all we know for certain is there’s writtings in the Bible that were taken from other places as well as stories. Amenope’s wisdom sayings in the book of proverbs and the story of the flood as copied from Mesopotamia, just two examples.
The Israelite stories we pretty much know are not really but just made up propaganda are that of the exodus , David and Solomon, Hezzekias Kingdom being saved by an angel, all the stories about the patriarchs in Genesis etc.