Of course, God knows about this, and tells Moses that he is going to destroy the Hebrews for their idolatry. However, he plans on building a great nation out of Moses, providing for him plenty of children and beginning a new people-group out of his line. He even explicitly forbids Moses from interceding on their behalf: Now let me alone, so that my wrath may burn hot against them and I may consume them (v. 10).
Moses, however, will not accept this, and begins to plead with God against his wishes:
O Lord, why does your wrath burn hot against your people, whom you brought out of the land of Egypt with great power and with a mighty hand? Why should the Egyptians say, 'It was with evil intent that he brought them out to kill them in the mountains, and to consume them from the face of the earth'? Turn from your fierce wrath; change your mind and do not bring disaster on your people. Remember Abraham, Isaac, and Israel, your servants, how you swore to them by your own self, saying to them, 'I will multiply your descendants like the stars of heaven, and all this land that I have promised I will give to your descendants, and they shall inherit it forever.' (vv. 11-13)
The response after this reasoned argument -- and notably not the repentance of the Hebrews -- is this: And the LORD changed his mind about the disaster that he planned to bring on his people (v. 14).
This is a fascinating little sequence of biblical events, and especially fruitful for theological reflection from the point of view of the classical theistic tradition. After all, God is omniscient and knows what will happen in the future even before it takes place. Likewise, he is immutable and impassible, and so is not affected by nor reacts to anything that happens within the created order. How, then, can we understand this peculiar affirmation that God changed his mind about what he was going to do to the Hebrews?
The classical theistic answer will be to interpret the idea about God's changing his mind as an athropomorphism. God does not literally change his mind about anything. Rather, it must be that this whole series of events was providentially ordered for our benefit, not because God was convinced to do something he was otherwise inclined to do. This means that God reveals to Moses, through the form of a prohibition, the fate which the Hebrews deserve as idolaters for their abandonment of the Lord. This revelation is ordered towards realizing the free intercession of Moses on their behalf, out of a concern as much for the good of the Hebrews as for the glory and renown of God himself. God subsequently uses Moses' intercession as a reason to be further merciful to the Hebrew people.
Catherine of Siena has the same experience as Moses. God reveals to her the horrible fate awaiting all those persons who live in mortal sin and who do not reconcile with God. He tells her:
How many charges I could bring against humankind! For they have received nothing but good from me, and they repay me with every sort of hateful evil. But I have told you that my wrath would be softened by the tears of my servants, and I say it again: You, my servants, come into my presence laden with your prayers, your eager longing, your sorrow over their offense against me as well as their own damnation, and so you will soften my divinely just wrath (The Dialogue, §17).
In both of these cases, the point of the revelation of the fate of the wicked is to provoke intercession on their behalf, so that such a fate might be avoided. Of course, God, because of his goodness and love, does not want the death of the sinner but rather her salvation. God tells Ezekiel: As I live, says the Lord GOD, I have no pleasure in the death of the wicked, but that the wicked turn from their ways and live (Ezek 33:11). He wants to be merciful to sinners regardless. But in his wisdom, he devises a way to include us in his mercy, making us a critical part of the way his mercy will be expressed to the world. He includes us in the economy of his mercy for our sake and for the sake of sinners and for the sake of his glory. And the revelation about the fate of sinners serves to motivate us to pray for them.
This is how I understand the rhetorical function of the threats, warnings, and predictions about hell and damnation in the New Testament. They serve primarily to motivate repentance on the part of sinners and intercession on the part of the people of God, ultimately so that no one may suffer the things described there. This, incidentally, is also how the Catechism of the Catholic Church reads them:
The affirmations of Sacred Scripture and the teachings of the Church on the subject of hell are a call to the responsibility incumbent upon man to make use of his freedom in view of his eternal destiny. They are at the same time an urgent call to conversion: "Enter by the narrow gate; for the gate is wide and the way is easy, that leads to destruction, and those who enter by it are many. For the gate is narrow and the way is hard, that leads to life, and those who find it are few."
God predestines no one to go to hell; for this, a willful turning away from God (a mortal sin) is necessary, and persistence in it until the end. In the Eucharistic liturgy and in the daily prayers of her faithful, the Church implores the mercy of God, who does not want "any to perish, but all to come to repentance." (CCC §1036-7).
What, then, should be the proper attitude of the Christian? It seems to me one of continuous efforts for the salvation of others. The threat of hell is a real one: people who die unreconciled to God are lost forever. But neither do I know if any of the people around me are going to die unreconciled to God, nor am I forbidden from preaching the gospel to them and praying for them desperately, with tears and sighs and groans like Catherine of Siena says, that God might have mercy on them and on me.