You can set non-printing speeds to be pretty fast so the move to a start position does not take too much time. You can choose between various start position algorithms in "Print Settings" > "Layers and perimeters" > Advanced" > "Seam position"
If you select "nearest" for the seam position, it should result in minimum XY move between layers.
This is not something that can be adjusted in the G-code.
Dave