A stronger case to leave, done right
Possibly, and your position may be stronger than in an ordinary lease dispute, but it still depends on the facts. When a unit is unlawful or seriously unsafe and the landlord will not fix it, tenants may have grounds to move out — and the unit's illegal status can add to that.
If an illegal unit has serious habitability defects the landlord ignores, or the city has deemed it unsafe to occupy, that can support ending the tenancy, sometimes through the idea of "constructive eviction," where a dangerous condition effectively forces you out of a home you cannot safely occupy. The fact that the unit was never legal to rent can strengthen your position.
Still, moving out without meeting the proper conditions can create disputes, so documentation and timing matter, and there may be additional claims worth preserving, like rent recovery or relocation rights.
Because illegal-unit situations are unusual and fact-specific, it is smart to get advice before giving notice or moving. A free, confidential review can look at your circumstances and help you decide the safest path.
This is general information about California tenant rights, not legal advice. Every situation is different.