Yes, the play was legal.
Normally, during the cleanup step, no player gets priority to cast spells or activate abilities. However, since the player affected by Silence controlled The Gitrog Monster and had to discard cards during cleanup, one of which was a land, players got rounds of priority. By that time, Silence had already ended and that player was allowed to cast spells.
- Cleanup Step
514.1. First, if the active player’s hand contains more cards than their maximum hand size (normally seven), they discard enough cards to reduce their hand size to that number. This turn-based action doesn’t use the stack.
The Gitrog player discarded 3 cards here. One of them was a land (Mana Confluence), so the Gitrog Monster ability triggered and was waiting to enter the stack.
514.2. Second, the following actions happen simultaneously: all damage marked on permanents (including phased-out permanents) is removed and all “until end of turn” and “this turn” effects end. This turn-based action doesn’t use the stack.
Silence ended here.
514.3. Normally, no player receives priority during the cleanup step, so no spells can be cast and no abilities can be activated. However, this rule is subject to the following exception:
514.3a At this point, the game checks to see if any state-based actions would be performed and/or any triggered abilities are waiting to be put onto the stack (including those that trigger “at the beginning of the next cleanup step”). If so, those state-based actions are performed, then those triggered abilities are put on the stack, then the active player gets priority. Players may cast spells and activate abilities. Once the stack is empty and all players pass in succession, another cleanup step begins.
The Gitrog Monster's ability entered the stack here and players get rounds of priority, allowing everyone to cast spells.