This will make the problem worse as the Portuguese will complain that the foreigners own the beautiful modern buildings.
Additionally it‘s important to keep in mind that this is not feasible for EU countries with the four freedoms. It would be like Florida banning ownership of existing houses for Californians.
(1) would totally kill the Portuguese tourism industry.
(2) is reasonable and they are already doing it - but not sufficiently.
I have a better idea: Tax the nomads with a rate that matches typical tax rates (around 30-40% and waive the crippling social security if health insurance is covered from abroad, not the excessive Portuguese taxes of 53% + 35% social security for a total of 88% on a salary of > 80.000. Nomads are fully exempted because nobody would be willing to pay that much). It would bring more than enough money into the country for house construction.