Many judges are on powertrips, but whether they are and whether this is "trivial" isn't the point.
This woman was asked to remove her headscarf, she refused and the judge responded. The appropriate thing to have done would be remove it and deal with the issue (if she wanted) later. Going to jail achieved what exactly? Nothing. Strike that. Now she will play the race/Muslim oppression card and file suit. Likely, this will be the best day of her life as it will equal some payout for "damages."
And disease, your arguments carry little water. The judge has a right to incarcerate people and deal with security inside his courthouse so far as the law allows. If you own a restaurant, you can enforce a dress and behavior code of some kind, but you can't de-robe people. And to follow your foolish analogy even further, clubs and restaurants limit what people can wear all the time. Hats and other headgear are typically restricted, so what's the difference?
The freedom to practice religion is not a warrant to dress and behave anyway you like. Nudists, for example, are not permitted to practice this belief in public. . .