The answers focusing on electrical codes are correct and valuable, but let's add an answer about physics
Generally speaking, a short run of thin wire is not a big deal compared to a long run of thick wire. Electrical codes exist because it specifically matters how short and how long and without the necessary training in physics or electronics, those numbers aren't obvious.
But here's the basic issue from a physics point of view: All wires are just fuses waiting for a large enough current to cause them to burn up. The point of breakers is to stop the flow of current before it gets large enough to burn up a wire that wasn't intended to burn up (i.e., it's not meant to be a fuse). But if you use a long-enough, thin-enough wire, the breaker won't trip before the wire burns up (which is why appliance fuses burn out before breakers trip). Conversely, if you use a short-enough thin wire, the breaker will trip before the wire burns up.
I apologize that this is a bit technical, but think of it this way. Sheet resistance is a phrase and a mathematical concept that identifies the resistance of a material to the flow of electrons (aka, current). It's usually expressed in ohm-meters. Copper has a specific sheet resistance (it doesn't matter for this answer what that is) and we'll use the variable ρ to represent it.
The resistance for a length of copper wire is calculated as R = ρ(Length/cross-section Area). A wire will burn when a specific current is passed through it (calculating that is too complex to worry about for this answer) because the wire's length and thickness can handle only so much power (power = Resistance * Current2).
The goal (simplistically, but good for this answer) is to guarantee that two wires will burn up at the same power level and that power level is greater than the breaker rating. The two wires can be any combination of length and thickness (gauge or awg) so long as they are compatible with those two rules. Again for simplicity, let's say that the two wires must have the same resistance. R1 = ρ(L1/A1) = R2 = ρ(L2/A2). This is a long and fancy way of saying that L1/A1 must equal L2/A2. If A1 > A2 (the area of a 6awg cross-section is greater than the area of a 10awg cross-section), then L1 > L2 (the length of your 6awg wire can be longer than the length of your 10awg wire). In other words, a short length of thin wire can carry the same load as a long length of thick wire.
Which is why you can plug a crappy 18awg lamp cord into an outlet served by a 20amp breaker and a 12awg wire without burning down your house. The short length of 18awg wire can handle the same power load as the longer 12awg wire.
And that's why it's OK for for your oven to come with 10awg wire. This is actually a pretty common occurrence. Furnaces, air conditioners, and many heavy-load appliances are assembled with light-gauge wires which must then be connected to heavy-gauge wires in the building.
I apologize for the lengthy, technical answer. But I wanted you to understand that the Electrical Code rules exist because of physics, and we follow them because Mother Nature has a nasty habit of not caring who's in the house when she's not respected.
BTW: Why isn't the Mathjax interpreter working on this Stack? $R=\frac{V}{I}$ should have resolved to an equation....