How to fix the position of a gradient in Illustrator, so that it doesn't move when I edit the object it's applied to?
How do I make Illustrator not change the gradient's position and size when I change the path's shape?
Essentially you don't. Gradient fills are based on the boundaries of the shape they are applied to. If you alter the boundaries, then the gradient position and length will change. It is simply how gradient fills work.
It's a very simple matter to grab the Gradient Tool and move the annotator to where you want it.