It will still swap back if you mash after the cast succeeds, but clever
I didn't realise you could programatically change stance bars - which means you can just check buffs.
Using jab, because it guarentees you will mash it at least once while the buffs are out even if you don't mash the ZS key, meaning the pages will update before your next cast. You could add it to your BoK key too, to cover the scenario of "no jabs for >10sec during a ZS>serenity>ZS", but you should be jabbing after ending serenity anyway before you ZS dps-wise anyway.
Code:
--page 2 macro for some filler (I picked jab)
/run if UnitAura("player", "Zen Sphere", nil, "HELPFUL") ~=nil then then ChangeActionBarPage (2) end
/cast jab
--page 1 macro for ZS
/cast [@player] Zen Sphere
--page 2 macro for some filler (I picked jab)
/run if UnitAura("player", "Zen Sphere", nil, "HELPFUL") ==nil then then ChangeActionBarPage (1) end
/cast jab
--page 2 macro for ZS
/cast [@whoever][@you][@like] Zen Sphere
ps: I hate you a little bit for making this brain-dead mashable. I like complexity dammit.
psps: you can merge it all into just the ZS macro if you want, but you may need to mash after the spell is cast for it to successfully update, putting the swap on a filler spell just removes the need.