Not based on what you wrote. There is no rule that says a player in formation can't leave for a sub.
Now, the sub must come inside the nines, the player he is replacing must leave within ~3 seconds, and everyone must be set for a full second before the snap. There is certainly a chance they violated one of those rules.
But being in formation and then leaving is perfectly legal if the other requirements are met.