In San Francisco there was a whole subsector of the market called "Richmond Specials" being built by a homegrown cabal of SF-born/bred builders on infill lots. Seems like these folks were most active during the dot-com heyday around the turn of the millennium.
But there's a much bigger sector of what is locally called "flats" that are essentially Victorian or Edwardian (usually) 2 or 3-story homes that have been subdivided into rental units, one per floor and possibly one in the basement for a total of 3-4 per building.
Here are examples. Note the 2 doorways in each building where originally there would certainly have been one large entrance door. Sometimes the doors visible between units will lead to a smaller lower level unit and often the garage will have been converted into living space for such a unit.
https://www.google.com/search?q=SF+M...8Imin2vrRns_M:
Trust me when I say these are not "tenements"--many people prefer them to other types of living units. Most have 2 or more bedrooms and rent for upwards of $3000/month.