The charges against her are not about her behavior during her court, they're about what happened once the court was adjourned and the defendant was starting to leave. She successfully defended the process within her own courtroom and it's alleged that she went a step further in securing the defendant from their impending arrest on an unrelated charge.
There's definitely a conversation to be had about whether people should be safe from immigration law enforcement while within a courthouse, but at the moment as I understand it that is not a protection that exists.
It doesn't matter if court was adjourned, she was still at work and performing her official duties. In particular she asked the ICE agents if they had a judicial warrant and was told no, it was administrative. A federal judicial warrant clearly outranks a local judge and it would be fine to arrest her if she defied it. It is not clear that an order from the executive branch does the same. That doesn't mean local judges are immune from federal prosecution (e.g. corruption charges if someone takes money to rule favorably), but there is a fairly high bar, I don't think her behavior even comes close to probable cause for obstruction of justice or shielding an undocumented immigrant.
The reason every other administration besides Trump refused to go into local courthouses to deport people wasn't about "whether people should be safe from immigration enforcement," it was about separation of powers.
There's definitely a conversation to be had about whether people should be safe from immigration law enforcement while within a courthouse, but at the moment as I understand it that is not a protection that exists.