Sugar is literally a poison, it's the reason why unchecked type 1 diabetes leads to deterioration of various organs. The body knows this but also runs on the stuff, so it tries to keep it at a sane level that does the least amount of damage to the body while still providing enough energy to run.
When blood sugar spikes, the body starts storing in the liver, when that storage is used up, it starts converting the sugar into cholesterol(and fat). Insulin is the primary hormone involved in this mechanism. So the body starts storing the energy in alternative non-immediately usable forms not because it runs out of storage and an excess of sugar in the blood is extremely harmful.
Protein based or complex carbs which convert to sugar interaction with this bodily hysteresis differently. It does not cause the blood sugar spike and the associated insulin surge.
Using a completely different line of logic, it's trivial to say that energy in / energy used is the dominating factor in weight gain or loss, when you examine people that eat a lot and don't gain weight regardless of exercise/fitness related factors, vs those that eat moderate portions with moderate exercise but nevertheless do not lose weight.
In short, there are a lot of factors involved here.