The flood is one of several incidents that demonstrate God does punish man for his sin, either directly or indirectly, Sodom and Gomorrah being the most obvious example. (Genesis 19) That being said, it doesn't mean that God wanted to literally destroy the whole world, but only the most offensive part.
We also understand that forgiveness of sin, even among the elect, doesn't always obviate the need for atonement or amends to be paid in terms of punishment. We witness this all the time when someone commits a wrongdoing, is forgiven, yet is still expected to make the situation right as best as possible.
If you, as a parent, caught your child stealing, you may forgive him, but you will also require he pay it back and perhaps be grounded for a while. How harsh the penalty often mirrors the level of contrition. A child who tries to blame someone else, mitigate his responsibility, or make other excuses, is liable to get a stiffer punishment than the one who comes back with tears in his eyes with deep regret.
Love covers a multitude of sins but, all too often, we are selfish. That is why for those who are saved, Purgatory is viewed not simply as a state of purification but a place of punishment. Those who die in a state of grace, but have not sufficiently made amends for their offenses, have some recompense to deal with. This is not a diminishment of the sacrifice of Christ, which alone can open the gates of Heaven for us, but rather an account of justice for the children of the Father who expects complete righteousness from his own, not simply in an extrinsically applied forensic imputation of justice, but an intrinsic justification.
So in the case of the flood, which I personally think was limited to what would be considered the known world, not everywhere on Earth, God purified humanity. Humanity was full of such grave sin that it was like wiping the slate clean. I don't think it contradicts God's plan to save humanity, because He knew that He would save the critical line that would lead to the Messiah, His Son, and He also knew, conversely, that all of humanity would not be saved, despite His desire to do so. Many would simply chose not to be saved. Jesus told us, wide was the road to perdition and narrow the way to salvation. (Matthew 7:13) This is a function of man's free will, not God's.
Lastly, the historical aspect of the flood is certain, but it is not likely that the literal whole world was destroyed, but the region that was affected was nonetheless cataclysmic. The scope of that discussion is beyond this reply, but suffice it to say that several ancient accounts and myths all attest to it, not just the Bible.