The fact that they're not able to pass 100% of the cost of whatever capital improvements they feel like on to their renters is part of a massive wealth transfer from landlords to long-established tenants.
In other circumstances I'd accuse that of deterring investment and being a contributor to the terrible housing situation in the Bay Area in general, but honestly, the zoning / planning-permit situation is the first limiting factor.
Instead of "massive wealth transfer", I think you meant to write "slight dent in disgustingly fat profit margins", because - just based on aggregate metrics - most landlords are making a stone-cold killing in this market.
Indeed, let's all shed a tear for the SF landlord. I don't know how those poor folks can stay in business when property taxes are capped and median rent rises at ten times the rate of inflation!
Individual landlords don't see (real) rent increases for apartments are all subject to rent control. They only get an incremental adjustment for inflation. If a landlord owns an apartment but it is occupied by a tenant under rent control, it doesn't matter if the property is "worth" 10x as much. His rent collected hasn't gone up, and he can't sell it for 10x as much because that tenant has very strong legal protections around his use of the property at its price. In that case, 90% of the property's annual returns is being enjoyed by the tenant for as long as he stays there. (He may be able to realize a gain after the tenant moves away or dies, but he's still lost out on the decades of rent which he would have been able to get at market rates.)
Considering that any landlord buying a property will certainly be on the hook for the downside in a property if the housing market crashed, and you'll see that this isn't the greatest. (BUT THE HOUSING MARKET ONLY GOES UP AND WILL NEVER CRASH hahahahahaha yeah right).
Anyway. In general one needn't shed a tear for landlords and capitalists of their ilk for failure to make a profit: the money is its own reward. But we do need to respect the money (because that is the reward), the precise behaviors we are incentivizing, and the impact of political risk which we are inflict upon the people we might want to spend money investing in the region. For instance: making things like this risky means that risk-tolerant entities are likely to be involved (which means the rich guys, speculators and businesses that San Francisco loves, not individual homeowners). And the price of the landlord assuming any political risk will find itself baked into the price of any new rental property.
But as I was saying: it's kinda moot from a median-apartment-price perspective if nothing new gets built anyway for other reasons.
Clearly, you have not heard of "rent control". I know people paying $1200/month for a 2BR in the heart of the City. I even met a guy who was paying $350 for a 1BR in Nob Hill, not far from Grace Cathedral.
About 72% of SF's units are under rent control. So not all landlords are making "fat profit margins".
I didn't say anything about zero risk. As the sibling comment indicates, if the cost is too high tenants will refuse to pay it by not renting the place. How long it takes the landlord to recoup the costs will depend on the local market for rentals.
Landlords may be the only group outside of government who is notorious for always going with the lowest bidder for jobs. A landlord who doesn't shop around for everything isn't going to be in the real estate business for very long.