The UK authorised this, years ago, because it's obvious that our economy is transforming so that fewer shops and offices are needed but the population is still growing.
The homes built under these rules are generally poorer quality, they tend to be smaller and more expensive to run than an otherwise equivalent new build home. But they are homes, and it's not as though San Francisco has too many of those.
At the extreme of what can be done, Birmingham is a British industrial city, and once upon a time as it began to take off there was enormous pressure to build homes so they constructed what were called "Back to backs". These were groups of homes packed together "back to back" so that you only had windows facing out one way, the other three sides of your home were walled in by other housing. They were squalid and almost all of them were torn down, although the World Wars diverted resources so that the last of them ceased to be homes only in the mid-20th century.
But historical preservation means Birmingham still has one set of Back to Backs, most of which is a museum you can tour to see how they were lived in during different periods, but one home was instead converted into a fairly nice two person overnight apartment you can hire. They plumbed a modern bathroom with shower and toilet, kitchen and so on, and of course in the 21st century we can light interior spaces cheaply and easily so it doesn't feel permanently gloomy, also of course it's just one couple in a double bed for one or two nights, whereas these would have been homes for families of eight people for a lifetime...
So yes, if there's money you can add everything. A Back to Back as constructed has zero running water, let alone sewage, unlike an office building so they'll have had to use modern narrow bore sewage pumping and other expensive tricks to make it work, but if the building would otherwise sit empty...