Playing the devil's advocate here:
Under capitalism, you could also see it as a provision of services where the landlord invests in the means of production (the building) and provides the service of letting people stay there for a certain amount of money. The offered services include the maintenance of the building. If a landlord is keeping a building poorly maintained and/or expects an over the top rent, then this is simply a bad service.
But well, this obviously doesn't work out as soon as you consider a safe place to live a basic human right that mustn't be commodified.
Well, I tried to find any arguments that could speak in favor of landlords. From the additional comments I got here it is pretty obvious that there isn't really any justification for housing to be in the hands of landlords.
It also assumes that the landlord is paying for the building with his own money instead of getting a loan.
The bank provides the money to build a house, the tenant pays the bank off and somehow at the end of this process the building belongs to the landlord.
This is the rub in some ways, but in others who risks their credit/capital and who also has the foresight to navigate the modern home building issues of financing a new home build for 2 years in many places without a shovel even hitting earth as permits and red tape are cleared? *It costs almost $100,000 just to get a permit in my North American city which the city keeps.
I chose to rent as I want to live where I want and don't want to deal with the issues of home ownership once the home is built or the taxes, however just the journey to building a home is no walk in the park and has changed a great deal since our great grandparents could just build any old house/shack they wanted on land they paid very little for as no one was living in the areas beyond the natives that once called these areas home.
I'm not even sure the cabin my grandfather built in the 70s on recreational property in a remote area that he ended up retiring to could even be built today.
In the cities where real estate pricing is through the roof due to demand, and occupancy is at record lows, those that can take the financial hit from delays and the costs to build a home are at present the only ones seeing homes being built in these conditions so the market in terrible ways have created a situation right or wrong of rewarding that initial capital investment as who else in their right mind would go through that just to have less than nothing in the end to hand it over to a tenant without a full refund of all of those costs in the first month by the tenant?
Without these builders I wonder how many renters would be able to fund paying for the land for 2 years, then the materials for building the home, and the labor, then navigate the city, and manage the builders and trades, while working at their job full time (not related to home building in many cases) while living somewhere else during this process along waiting for a close with city approval to occupy once completed which might push this to 3 years?
Paying both the bank and then your rent to live somewhere during this process isn't cheap either.
If the market relied on monthly renters for home building I suspect MANY more of us would be living in tents or campers... Which is also happening in the current system too but perhaps not at the same degree?
How do we as a society trigger the removal of red tape, nimbys, and fund the building costs of higher density housing might be a better question to ask as these challenges need to be tackled to see more homes built. Getting around the reward paying for the large upfront costs of building homes needs to be navigated too.
Unfortunately moving further west is no longer an option due to the west having run out for many of us.
While the risks you describe are correct, it would seem that in some places the landlord expects an annual return of around 10%. That looks like an insanely high number to me and I don't think that the risk is this big.