The physics
The plates of a charged capacitor pull on each other. Each plate feels only the other plate's field, E/2.
F = Q²/2ε0A = ½ε0E²A
With the switch open, Q stays. So the pull stays the same at every gap. All your work goes into the stored energy.
With the battery on, V stays. Pulling the plates apart lowers C, so charge flows back into the battery.
your work + the battery's work = the change in stored energy
The stored energy sits in the field. Each cubic metre of it holds the same amount.
u = ½ε0E² (J/m³)