I don't know if this would apply to a commercial tenant.
But it would definitely not apply to non-violating conditions like the OP's case.
Was the unauthorized modification permanent or undoable? If the latter, I think some people should really get their judge card (or landlord card) revoked.
Did the judge at least suggest what alternative action the tenant should have taken to comply with the law and code?
Whether or not it's worth all the trouble and time is a different matter. For most people, I'd say reporting to relevant authorities to make the landlord's life harder without needing much continuing effort is probably worth doing, but the lawsuit side is likely to be a huge time and money sink and it's almost always easier to just move. Let the city sue them for continuing to accrue complaints of unsafe living conditions.
In the same way, a landlord cannot evict you themself if you just fail to pay rent, but there are multiple legal mechanisms to eventually get the sheriff to do it for them. Basically, if landlord-tenant negotiation fails, I think the only legal recourse is to involve governmental third parties unless you technically open yourself up to legal reprisal.