Of course that’s not what happened. But it’s interesting the way the Bible is written:
Exodus 32: 11-14:
Then Moses pleaded with the LORD his God, and said: “LORD, why does Your wrath burn hot against Your people whom You have brought out of the land of Egypt with great power and with a mighty hand? Why should the Egyptians speak, and say, ‘He brought them out to harm them, to kill them in the mountains, and to consume them from the face of the earth’? Turn from Your fierce wrath, and relent from this harm to Your people. Remember Abraham, Isaac, and Israel, Your servants, to whom You swore by Your own self, and said to them, ‘I will multiply your descendants as the stars of heaven; and all this land that I have spoken of I give to your descendants, and they shall inherit it forever.'”
So the LORD relented from the harm which He said He would do to His people.
So the above is nonsensical if God is omniscient. How would He ever change His mind? He already knew before Moses was born, what he would plead at this moment.
Here is how Guzik explains it:
ii. Numbers 23:19 says, God is not a man, that He should lie, nor a son of man, that He should repent. Has He said, and will He not do? Some say that these two passages contradict each other, and that Exodus 32 shows God repenting and changing while Numbers 23 says God never changes or repents. We can understand these passages by understanding that Moses wrote with what we call anthropomorphic, or “man-centered” language. He described the actions of God as they appeared to him. Moses’ prayer did not change God, but it did change the standing of the people in God’s sight – the people were now in a place of mercy, when before they were in a place of judgment.
My own thought on this particular episode is that God wanted Moses to soften his heart. After this pleading, Moses walks down the mountain and absolutely flips out when he sees the golden calf that the people–under Aaron’s leadership–have created. Since Moses’ character flaw was his temper, I think one of the elements in this story is that God actually conditioned Moses to have mercy before he saw just how wretched the human condition is.