It isn't a violation. Nothing in canon has said she wasn't acting captain for a short period of time.
Maybe the Enterprise is laid up in spacedock during the period Pike is on the Discovery in which case no one is in any real command of her.
Enterprise has seen many captains.

My questions is, who the hell is Zarlo?!