Does the optimal saddle height depend on whether you are mashing or spinning?
I find that I tend to slide back on my saddle to get more leg extension
When I do this , I'm usually forward on the nose of the saddle.
It's normal to move as you describe on the saddle as terrain and wind conditions change. Hence the term "on the rivet" from when saddles had leather tops w/ a rivet on the nose and one was making a substantial effort, likewise sliding back on hills.
A properly set saddle height allows both because one uses both techniques on road rides, lots of well documented fitting systems out there to calc your ballpark/home fit. Special event positioning like time trialing or hill climbs can favor F/R bias and a plethora of other adaptations that make little sense for general road riding. Find an experienced fitter in your area and a good coach.
-Bandera