Unfortunately, you (and people and companies like you) are one of the core reasons why young people can't buy affordable housing.
Every unit taken off the market as an "investment" or for use as an Airbnb or whatever is still a unit taken off the market, which in turn drives up competition and limits the supply of homes available for first-time buyers.
Individually, you and people like you are just trying to do what's best for you and your families. And that's understandable.
But the collective end result is something that's detrimental to society as a whole. What might seem like a smart personal financial decision for one person becomes, in aggregate, a significant contributor to housing scarcity, inflated prices, and long-term social inequality.
The responsibility isn't just on individuals but on a system that incentivizes such behavior, and without addressing these systemic issues, housing will remain out of reach for many.
One thing that could be done is dramatically increasing property taxes and eliminating deductions on non-primary use residences. As well as increasing taxes on the income derived from such, with those dollars going towards increasing the supply of affordable housing.