Here is what I have written before on the Epic of Gilgamesh, since it deals with the OP:
In the post below, you will find the ancient Sumerian flood narrative [omitted here, unless someone wants it]. We don't know when it was first told, but it was first written down some time around 2000 B.C.. This not only predates the actual writing of the Genesis account, it predates Moses by and even Abraham by hundreds of years. Now, Abraham is actually very important to this development. Abraham was from Sumer. He would have grown up with this story, as would have Sarah and Lot, etc. This was part of THE major epic narrative of their past, and it is difficult to believe that this story would not have passed down among his line.
Now, many hundreds of years later, we have the Genesis account written down, with many, many striking similarities in details. Now, even hardcore literalists like ICR acknowledge that the Genesis account was almost assuredly based on an oral version being told by the Hebrews before it was written, and that it was not just dropped on the Genesis writer as a new revelation and I don't think anyone disputes this.
Further, even the hardcore literalists agree that the first civilizations grew up in Mesopotamia, in Sumer, and that Abraham and his descendants are derived from that culture. Even if one takes the genealogies as true, it would mean that everyone on the list up to Noah, and then from Shem to Abraham was from Mesopotamia. This is true because the literalists also assert that Eden was in Mesopotamia. So, I don't think anyone would dispute that Noah was from Mesopotamia as well.
This means that the person who was saved from the flood was from Mesopotamia and the earliest account of the flood, even by literalists standards, would have to have arisen in Mesopotamia. Now the Epic of Gilgamesh includes that story, and it became their major cultural story about their past. And, again, that is where Abraham eventually was born and raised.
So, lets consider the possibilities:
1. The Sumerian account was passed down among the descendents of Abraham and, over hundreds of years, it evolved into the account we have in Genesis.
2. The descendents of Abraham never heard the Sumerian story and, thus, their version could not have derived from or been influenced by the Sumerian flood narrative.
I just don't see number 2 as a viable option. If someone wants to make a case for number 2, feel free.
Assuming 1 for the moment, then, we have the Hebrews starting with the Sumerian version and then changing many of the details at some point to what we have in Genesis today. The question then remains whether all the details they changed was a process of converting it back into the historically accurate story. This is not the usual process for story development. It usually get further from historicity the further it gets from the source. By the time the Sumerian version was written down, the story had already grown from whatever event caused it's writing to a highly mythologized account.
I believe that God was definitely involved in this conversion process to some extent, but I do not think it most likely that He guided the conversion back to literal history. I have no reason to think that this would be necessary.
But what would this mean for Biblical veracity? I am with C.S. Lewis on this one:
I have therefore no difficulty in accepting, say, the view of those scholars who tell us that the account of Creation in Genesis is derived from earlier Semitic stories which were Pagan and mythical. We must of course be quite clear what "derived from" means. Stories do not reproduce their species like mice. They are told by men. Each re-teller either repeats exactly what his predecessor had told him or else changes it. He may change it unknowingly or deliberately. If he changes it deliberately, his invention, his sense of form, his ethics, his ideas of what is fit, or edifying, or merely interesting, all come in. If unknowingly, then his unconscious (which is so largely responsible for our forgettings) has been at work. Thus at every step in what is called--a little misleadingly--the "evolution" of a story, a man, all he is and all his attitudes, are involved. An no good work is done anywhere without aid from the Father of Lights. When a series of such retellings turns a creation story which at first had almost no religious or metaphysical significance into a story which achieves the idea of true Creation and of a transcendent Creator (as Genesis does), then nothing will make me believe that some of the re-tellers, or some one of them, has not been guided by God.
Thus something originally merely natural--the kind of myth that is found amongst most nations--will have been raised by God above itself, qualified by Him and compelled by Him to serve purposes which of itself would not have served.
God used this story, with which His people were very familiar, adopting it for His purposes, to convey great and important truths about His relationship with Mankind.