Train cycling legs for a long walking trek
I'm with you on this. My summers often include a mix of cycling and hiking/backpacking, where cycling is the dominant activity.

Two things that have helped me. The major one is to use trekking poles. I discovered trekking poles one summer after breezing through some difficult rides, and then being devastated on a not too serious hike. The poles significantly reduce the leg impact, especially on the descents. The second thing is to cross-train between hiking and cycling; but that depends on your personal time constraints and goals.