You are forgetting the trusty Ziploc full of nuts and raisins (or trail mix as or American cousins call it). Helps that it’s actual food but the energy release is nothing like as immediate as sugary stuffs
I go with a combination of a bag of nuts and fruit plus a bag of sugary stuff (haribo an obvious favourite), eat something one an hour and electrolyte wotsit in my bottle/camelbak (although I probably only see the benefit from that on longer rides.
On the road (or if you find a handy shop on the trail) a can of full fat coke or other caffeinated sugary beverage of choice is a magical shot to the muscles if you’re bonking a bit