That is a good point that I hadn't thought of. I lived in an illegal unit in San Francisco—a buddy and I got permission from our landlord to put up a wall subdividing our bedroom in Bernal Heights into two smaller bedrooms. Some of my favorite years ever...
What about illegal additions or illegal buildings? This seems less common to me.
Unpermitted additions are extremely common, as are "illegal" backyard cottages.