Let's be clear on terminology. When you say long term thru, are you meaning a couple of weeks or months? I take it as months yet you gave a two week example. That distinction makes a HUGE difference.
You didn't give any details on daily mileage, your weight (including pack, elevation gain etc. so it's tough to be specific. But my rule of thumb on high mile days with significant elevation gain is you will burn 1 calorie per pound per mile. In my case, fully loaded out, I weigh 200 lbs so 200 calories/mile is my estimate. So for a 30 mile day, I would expect to burn 6000 calories and a 40 mile day would be 8000 calories. So I'm a bit skeptical on your 9000 calorie number unless you were doing 40+mile days with 10k elevation gain or 30+ miles with a total weight of 300lb.
So let's make some assumptions. Let's assume you are talking two week trips AND that you have a few pounds of fat to spare. If you say you don't, I will call BS :) Finally let's also say you are doing 30+ mile days. In this scenario it is entirely possible that the problem is not how many calories you took but that you took the wrong kind. When I look back three years I realize how wrong I was in my food selection.... And I blame BPL. :O Why? I was in search of the HIGHEST CALORIE DENSITY to minimize the weight of say a 3500 calorie load. I now realize how absolutely wrong that approach is FOR THE SCENARIO I LAID OUT ABOVE. Why? It was way too high in fat and the protein was wrong. I had macadamia nuts, cashews, peanut butter, olive oil, all of the good high-density foods that always get talked about to minimize weight. But I was doing nothing more than carrying spare fat, my body already had more than enough fat stores to do a trip like the JMT or your trip listed above.
Two years ago after a snowshoe trip, posters here (Greg and Tom) suggested I look at a higher carb food carry. That thread changed my hiking forever. While I went the route of drinking my calories in via Maltodextrin, how the carbs are consumed is less important than the total carb load. I have been thinking about how to explain this for months now because I believe many are following in my earlier sub-optimized footsteps. Let's look at some numbers. Two scenarios, both using ideal foods with zero water etc. Both have a weight of just over 40oz.
Scenario 1 - Optimized weight load (high fat) - 7000 calories
Fat – 41%
Protein – 19%
Food weight – 40oz., theoretical calorie density 172 cal/oz.
Scenario 2 – High carb load. – 5200 calories
Fat – 10%
Carb – 70%
Protein – 20%
Food weight – 40oz., theoretical calorie density 128 cal/oz.
Which diet will fuel you better? What I have found is diet number 2. Why? Diet number 2 has 3200 calories of carbs which at 100 calories per mile will easily fuel 32 miles/day and beyond day after day. At 32 miles per day I would have a calorie deficit of about 1200 calories which could be sustained for a couple of weeks. On the other hand the high fat diet has less than 1900 calories from carbs. While this could likely work for a day or two, I suspect many would eventually deplete their gyclogen stores and end up fading in later days.
So in summary, get rid of the fat. Leave the peanut butter, nuts and olive oil at home, or save them for a multi-month thru hike where they are absolutely required.
Please note that the numbers that I used are my best estimates for me and will vary from person to person. Look beyond the number to the concepts behind them. This concept does not apply to multi month thru-hikers, they can not rely on fat storage and need to look at overall calorie consumption in addition daily fueling. And finally if you are doing low miles, under say 20/day then you can likely eat anything you want, it won’t matter.