Questions about the historicity of the flood shouldn't cloud the point of the story of the flood and of Noah and the covenant. The point is the contrast between God's attempted destruction of all living things because of the continual evil of the human heart (6:5) with God's recognition that this is not the way to deal with that evil. (See 8:21-22; 9:8-17) This is preparatory to the calling of Abraham and Sarah as God's response to the evil of the human heart, leading to the new covenant prophesied by Jeremiah and others (Jer 31:31-34) fulfilled in Jesus (Matt 26:26-29). I don't take the Genesis story to mean that God had to learn this. The story is a literary device to make the point; and it does so effectively. And it is not difficult to see this, especially given the function of Genesis 1-11. Incidentally, this story also criticizes human beings,, for we have not learned that killing off the 'evil ones' will not magically bring righteousness.
We meet something similar in Genesis 18 and Exodus 32. In these stories Abraham and Moses respectively convince God that destroying people is not necessarily the best thing to do, and frankly questionable considering the kind of God God is. Some people are tempted to read this as literally true, which makes God needing to be persuaded. (Or at best a test of Abraham and Moses). Whether these stories have some more ancient source and began their life with such an interpretation, this is not how they function in the Bible now. They are, again, literary devices highlighting that, even under extremis God is just and merciful (Gen 18) and faithful to the covenant (Exod 32). In the latter case, it is the covenant that is more important than the sin itself, and God acts on sin, not the other way around. This comes directly out of the source of the covenant, but more on that later.
For further discussion of this point see Rowan Williams, Tokens of Trust, pp. 17-19, or point 12 in my Chapter 1 study notes.
For Pentecost 22(A)