A couple years ago, I did a 90 mile hike in Scotland, which was mostly flat. My pack weighed just at 20-25lb (light but not ultralight - a lot of water weight). The trail was MOSTLY flat, with a couple steep trails to bypass forestry work, and crest over some steep hill.
I'm a large man, at the time I was pushing 250lb on a 5'8" frame, but I found my flat land endurance was basically unlimited at walking pace. My uphill endurance was limited so short bursts, and I had to regularly stop for a breather.
Once on flat ground, again, 20+ miles a day no issues.
After the detours, and some one-off side trails to see something, and walking from the trail to a town for food and/or sleep, my entire trek was 125mi over 5 days. And when I got home, I weighed 255lb. I gained 5lb while hiking somehow.
All that to say, uphill endurance is no joke, and it is hard to train, even maxed on a treadmill if you live on flat ground. Stair climbing (or machine) is the only thing I can think of.