I don't think it was a violation of the gag order. It didn't contain any details or comments about the witness, just saying that his team were given no notice because the judge is corrupt and it's a witch hunt. I think 'political statements' about the judge and the trial in general have been consistently overlooked as not covered by the order, it only explicitly protects witnesses and other court staff.
I think the reason his lawyers made him take it down is actually a bit more nuanced. The Prosecution had been withholding the order in which they were going to call witnesses (which is their right). This is something that the Defence is normally told as a common courtesy but the State declined to provide the order of witnesses because the Defence kept leaking things to the media. A few weeks ago they came up with a compromise which was basically "we'll give you 24 hours notice of the next witness, but if anything gets leaked we'll revoke that right."
Trump posting in the way he did made it obvious that the next witness was Daniels. The Prosecution would have no doubt taken that badly and revert to giving them zero notice. Which is ironically, the thing Trump was complaining about.