But these came before the Genesis version, so I'd think the story in the Bible was borrowed from an earlier one.
There is an MA Thesis on this topic
, by Nozomi Osanai,
A comparitive study of the flood accounts in the Gilgamesh Epic and Genesis, Wesley Bible Seminary, USA, 2004.
https://creation.com/comparative-study-of-gilgamesh-and-genesis-introduction.
In the introduction there is an acknowledgement of your view, and that of most scholars.
"Comparing the flood stories in the Gilgamesh Epic and Genesis, one is impressed with the numerous similarities between the two accounts. The common elements between the two have been perplexing for some scholars. Alexander Heidel shows the three main possibilities about the relationship between the two accounts: “first, the Babylonians borrowed from the Hebrew account; second, the Hebrew account is dependent on the Babylonian; third, both are descended from a common original.” The Gilgamesh Epic and Old Testament Parallels, "Because the Epic written in Akkadian predates the Old Testament written in Hebrew, “The most widely accepted explanation today is the second, namely, that the biblical account is based on Babylonian material. This theory poses an awkward problem for Christians. While the fact that there are flood legends like the Genesis Flood account in most cultures around the world is used to testify to the reliability of the Bible, the Gilgamesh Epic is used to deny the authority of the Bible because of its predating."
There are 7 chapters between the introduction and the conclusion.
The conclusion made some excellent points. I haven't posted all of them, but here are the concluding remarks, I added the bold letter for emphasis:
"
This writer believes the third theory—that both accounts descended from a common origin—is the most plausible one. As noted in chapter one, the Epic was likely derived from the Sumerian story which was probably based on an historical event, though distorted. On the other hand, according to the specifics, scientific reliability, internal consistency, the correspondence to the secular records, and the existence of common elements among the flood traditions around the world, the Genesis account seems to be more acceptable as an accurate historical record.
If all human races are descendents of Noah’s three sons, the survivors from the universal Flood, and the two accounts had derived from the same historical event,2 the reason the accounts have many similarities is explicable. As K. A. Kitchen states, it is likely that “The Hebrew and Babylonian accounts may go back to a common ancient tradition, but are not borrowed directly from each other.”3 Even though the Genesis account was written in Hebrew which was used later than Akkadian in which the Epic was written, the historical event of the Flood was much earlier than the publication of the Epic. Henry Thiessen writes
First, it is known generally that a considerable portion of the people could read and write as far back as the time of Hammurabi; that genealogical tablets and lists were known in Babylonia centuries before Abraham; that it is possible that Abraham carried cuneiform tablets containing such records with him from Haran to Canaan; and that in this manner Moses may have come into possession of them. Whether because he had access to such records, or because he had only oral tradition, or because he had only a direct revelation from God, or because of a combination of these, conservative scholarship has always held that Moses wrote Genesis.4
Even if Moses had used some source materials which are not extant today, the process of his gathering and compiling them to write Genesis would have been guided correctly by God.5 Thus, after investigating the differences between the Gilgamesh Epic and Genesis, it seems reasonable for this writer to conclude that the flood account in the Epic is the story which lost historical accuracy and was distorted, whereas the Genesis Flood account is the accurate historical record of the Flood event."
https://creation.com/conclusion-of-nozomi-osanais-thesis-gilgamesh-epic-v-genesis
The Bible says that God spoke to Moses many times, even as one speaks to a friend. I agree with the conclusion that Nozomi Osanai stated. Even if oral tradition and written records were sources for Genesis, God ultimately "guided" Moses.
Exodus 34:29-35
"29 When Moses came down from Mount Sinai with the two tablets of the covenant law in his hands, he was not aware that his face was radiant because he had spoken with the Lord. 30 When Aaron and all the Israelites saw Moses, his face was radiant, and they were afraid to come near him. 31 But Moses called to them; so Aaron and all the leaders of the community came back to him, and he spoke to them. 32 Afterward all the Israelites came near him, and he gave them all the commands the Lord had given him on Mount Sinai.
33 When Moses finished speaking to them, he put a veil over his face. 34 But whenever he entered the Lord’s presence to speak with him, he removed the veil until he came out. And when he came out and told the Israelites what he had been commanded, 35 they saw that his face was radiant. Then Moses would put the veil back over his face until he went in to speak with the Lord."
Exodus 33:11 "
The Lord would speak to Moses face to face, as one speaks to a friend."