It wouldn't be a problem if the tax burden was on property owners.
If someone purchasing 500k EUR apartment had to pay even 2% of real value of it every year to local community they would be welcome with open arms.
Unfortunately right now it's not the locals nor the local infrastructure that capture the benefits.
If Spain (and most of the EU) had saner regulations then who knows, maybe they would even allow for building more in places people want to spend time in.