Your trigger needs a condition on it, right now any change on any invoice is triggering it.

Something like When Invoice Before change is empty so it only runs when a new one is created.

The condition on the action needs to beSearch for Invoices:count > 2 (constraint Quotation ID = Invoice now's Quotation ID"