The term “Ten Commandments” (actually, “ten statements”, as Lynwood mentions) also appears in Deut 4:13 and 10:4. The reference is always to the commandments carved on the stone tablets, rather than other commandments which were not so carved.
I don’t think your seeming contradiction is as awkward as you might think.
If you accept the Documentary (multiple-author) theory, then the first set of Ten Commandments, from Ex 20) are from the priestly author “P”, while the set of Ten Commandments you’ve cited from Ex 34 are from the author “J.” The multiple-author theory is, of course, ultimately unsatisfactory as an explanation, because the Redactor certainly edited the material together, so we really do have one “author” or editor, regardless of source material. We are therefore justified in viewing the entire Pentateuch text as a whole work, whether by one Author or by one Editor being irrelevant for analysis.
Remember the overview of the story: the people arrive at the mountain, assemble and prepare themselves, and God’s voice speaks to the entire people (Ex 20), what we call “The Ten Commandments.” The people are fearful and can’t bear the direct contact, and so Moses is delegated to speak to God for all the rest of the commandments, the whole next bunch of chapters to Ex 32. Note Ex 31:18 – after God speaks alone to Moses, He carves two tablets with the Pact. “The Pact” is assumed to mean the words spoken to the whole people.
In the Book of Deuteronomy, Moses is speaking his farewell address to the people, and he reminds them, in Deut 10:4, about “…the Ten Commandments that He addressed to you on the mountain out of the fire on the day of the Assembly.” Similarly, the usage in Deut 4:12 -13 refers to “The Lord spoke to you out of the fire… He declared to you the covenant that He commanded you to observe, the Ten Commandments.” It’s fairly clear that the term “Ten Commandments” refers to the spoken words from Ex 20.
In Chapter 32, Moses comes down, finds the people worshipping the golden calf, smashes the tablets in anger, and must go back up the mountain to try to appease God’s wrath. God gives Moses yet more commandments, including those you cite from Chapter 34. Note that Chapter 34 begins, “Carve two tablets of stone like the first, and I will inscribe upon the tablets the words that were on the first tablets which you shattered.”
Hence, the assumption is that the “extra” ten commandments in Chapter 34 are just another set of ten, they’re not “The” ten commandments. Does that explain it?