There were many days that I ate up to 6000 cal of pure junk and Maltodextrin plus another 2000 cal of other stuff.
The best advice I saw and adopted was "Carbs for hiking, protein for recovery!" That doesn't mean zero protein during the day because as others said there is some protein in most foods. As for why hikers are bonking? I hiked with a couple of hikers on my thruhike that were likely as strong or stronger hikers than I was. But they failed to meter enough calories into them during the day and they bonked often in the mid afternoon. I target about 280 calories per hour, mostly pure junk food and maltodextrin. At the day's end I will eat more nuts and other protein sources as well as a healthy shot of carbs for recovery. I only had one day that I bonked and that was a 40+ mile day with rationed food heading into a resupply.
Finally, don't overthink it. Take enough foods that you can actually eat and meter them in all day long.