It is difficult to conceptualise.
But you also have to choose the most convenient observer to help you get it.
I would say the easiest way to "get it" would be to consider it from the Suns observation point of view. Choosing the planet or spacecraft just means that you have to consider a lot more relative motion.

- Situation A: Your space craft is catching up to the planet;
- Situation B: You have gained "29" speed as you fall toward it.
- Situation C: You spend 20 speed climbing back out of the gravity well; for a total speed gain of 9.

- Situation D: Same setup, you catch the planet quicker because it is now traveling toward you.
- Situation E: You have only gained "11" speed rather than the 29 when the planet was moving away from you.
- Situation F: You still spend 20 speed to climb out of the gravity well; for a total speed loss of 9.
This is obviously simplified and the numbers are meaningless. But the concept stands.
Depending of the incoming and outgoing angles; the energy changes are more or less....
Hope this illustrates it a little better.