I noticed that there are occasionally test flights by Airbus A220 aircraft in and out of the Airbus production site at Mobile, Alabama (KMOB). Some of these aircraft use what are presumably test registrations for the flights, but these test registrations are Canadian. Here is one such flight, using registration C-GPUV. I know the A220 was originally the C-Series, produced exclusively in Montreal by Bombardier, a Canadian company, but shouldn't the aircraft produced in the US use US test registrations?
The airplanes are built/owned by an Airbus subsidiary incorporated in Canada, and the Mirabel facility is still the primary production facility and location for the engineering organization, etc.
Mobile is effectively a "branch plant".
It's still a Canadian certificated design, being built by a Canadian incorporated business entity (an AB subsidiary), with Transport Canada as the primary regulator for all certification matters. Therefore, aircraft have Canadian Registration before a C of A is issued.
The various certification organizations have reciprocity agreements. When the FAA certifies an aircraft, Europe, Canada, Australia, etc. accept that certification. That way, Boeing (for example) doesn't have to go through cert multiple times in different countries when it wants to sell to different customers, or those customers want to operate in different countries.
Not all countries have the capability to certificate an aircraft a the highest standard. It takes a large investment to get to that point.
The A220 was a Bombardier made CSeries that went through cert in Canada. It would be terribly expensive to re-certificate an aircraft just because you built a new factory in a different country.
Furthermore, you are not limited to the manufacturer's country of origin for the initial cert. For example Bell Helicopter (Textron) from Ft. Worth Texas often certificates helicopters in Canada.
Here is a list of bilateral agreements from the FAA. These agreements do not have to be symmetrical -- i.e. Country A may accept cert from Country B, but not vis-versa.