I live in another EU country, that in 5 years I could easily see being as this article describes Portugal. I'm not sure if it's the same in Portugal, but this is only really accurate for major cities in my country.
Smaller cities and towns are cheap. I've seen government auctions selling apartments for under €5000 which nobody wants. Why? Because people are moving to larger cities. People want opportunities, and the idea of working in some chicken factory (which may have been a perfectly respected career for our parents) is not appealing for the current generation. And the problem in these small towns, is the chicken factory is really the only career prospect you have, so people move elsewhere.
Of course there are rich foreigners buying apartments as investments and renting them on Airbnb, but that's a very small percentage of the housing market. And even if they rented them normally, they'd still be asking for prices that are unaffordable for the average person. I know that because that was me, I emigrated here and bought a luxury apartment and lived in it for 7 years (paying taxes) and now want to rent it out as I moved outside the city.
Unless I rent or sell it for much lower than the market rate, even on the lower end it's still too expensive for the average person. If I sell it, it's probably just going to be poached by someone who will use it as an investment and put it on Airbnb.
My city is building a lot of new developments, but space is limited as young people want to live close to the city center, not somewhere 30 minutes drive away. That is driving up the average price, so you end up with studio apartments costing upwards of €4000/m2, which you need to earn at least €2500/mo to afford, which is well above the average salary. With rising inflation the problem isn't so much people can't afford the mortgage payments (which are slightly lower than renting), but they can't afford to save the 15% needed for a deposit.