Yes, you’ve missed something, which is that your muscles are not equally efficient over their entire range of contraction, they are not equally efficient at all loads, and not all muscles are equally efficient.
The correct answer varies depending on your weight, fitness, slope and length of hill and so forth. But generally you use less energy building up momentum on level ground.
When given the choice, your body will apply force using the muscles that are able to do so most efficiently, over the range that is the most efficient for the muscles being used and at the force that is most efficient for those muscles. So when you are on level ground and you ask your body to produce more speed, it will naturally do it using mainly the leg muscles, and in the most efficient range of the leg muscles. And it will build up momentum gradually so that the muscles are always generating force in the most efficient range
However, when you are struggling up a hill, your body has no choice. It needs to generate force using a broad range of muscles including the arms, shoulders and abdominals, and it needs to generate force over the most of the contraction range of those muscles and it needs to generate a minimum amount of force constantly.
That all makes it much more efficient to build up momentum of the flat, and use that to coast over the hill.
As a* reductio ad absurdum *example, imagine a typical skate ramp. Almost anybody at any level of fitness could build up enough momentum to coast from the base of that ramp to the top. And conversely, most people would struggle to start their bike from the bottom of that ramp and pedal to the top. They simply would not have the strength in their arms and abs to pull the weight of their body the top from a dead stop.
Which proves that the most efficient way to get to the top is via momentum. A dead start is so inefficient that the machine can’t even manage to do it given an infinite amount of time and infinite amount of energy.
Note that this isn’t unique to the human body. All machines have a range over which they are most efficient. You won’t start car or truck moving on the types of hills which they will coast over easily at 80mph.