Strength, strength, strength. While your aerobic capacity is quite likely improving well on the flatter terrain workouts, you’re still imposing a greater load when you head uphill and against gravity. More components of the muscles must come into play than on flat ground, and those new components are likely not as aerobically-capable and there are also fewer of them than ideal.
Make sure you progress through a comprehensive strength program: begin with a general phase of 3x 12reps of some basic prime mover exercises: squats, deadlifts, box steps, split bench squats, etc. Then move into max strength (4x 4-5reps, etc) and finally muscular endurance. All the while, continue increasing your time spent on uphill terrain WHILE minding your AeT limit. You’ll see the HR stabilize and your economy (i.e. speed) improve, no doubt.