You are using a FOR trigger; this is a different way of specifying an AFTER trigger. And you need to switch this to an "INSTEAD OF" trigger.Please refer to this webpage.
The reason it is failing now is because SQL Server validation is occurring prior to your trigger executing and performing it's primary key creation.