What would make even more sense is very severe fines to the landlord for renting illegal units. Something like a multiple of all the rent they have ever collected on it.
Now, if there was a way a tenant could make a legal unit into an illegal unit and then invoke this, I could see that as a problem.
I can understand the confusion because I once interned for a midwestern city's planning department. There if someone built an unapproved apartment above their garage, the city would hit them like a ton of bricks.
In San Francisco, it is not like that, and these so-called "illegal" units are enshrined by law and practice in many respects. As a tenant, you have nearly all the same rights as a legal unit, so this would probably not figure into your evaluation.
The owner seemed to be caught in the middle of two incompatible laws: 1) You can't have that person living there. 2) You can't make that person leave.
Step 1 - Buy a property that is impacted by certain regulatory constraints (which depresses it's market value heavily). Step 2 - If you are cheap, sit, wait, and pray that natural forces relive you of the regulatory burden (or make life a living hell for your existing tenant in an attempt to get them to move out). If you have some money, actively spend it to rid your property of regulatory constraints. Step 3 - Once unburdened (or partially relived) of said constraints, sell the property and profit handsomely.
This game is primarily played with rent controlled units and TICs. The owners in question bought property on the cheap, evicted an old disabled lady who is now homeless, and made bank. Sure, the lady was a piece of work herself, but let's not pretend these owners were saints, they knew what the endgame was all along.