re: 1) That article is about a French multinational oil company entering a commercial agreement with Iran. This doesn't relate to an EU member state doing a "side" trade treaty with a non-EU member.
Any other EU company could have done the same.
re: 2) Seems like that provision was in the agreement Switzerland made with the EU:
from: https://www.swissinfo.ch/eng/business/freedom-of-movement_sw...
> Switzerland first activated such a safeguard clause – a controversial instrument of its complex dealings with the EU – in 2012, to limit the number of citizens arriving from certain new member countries who joined the EU in 2004..