Brings back memories from the 1980s...
Having to go through US customs and immigration checks before leaving Canada is nothing new.
I remember being given US forms to fill in before boarding a Vancouver-Sydney flight even though I was not entering the United States (merely spending an hour in transit at Honolulu).
After explaining to a very officious bureaucrat that I actually didn't need the forms, I was told in no uncertain terms that I would not be allowed on the flight unless all the documentation was completed.
I relented, and sure enough eventually arrived in Sydney still clutching the unnecessary American paperwork.
Background fact: In those days trans-Pacific CP flights from CYVR did not depart from the international terminal but from some other place called "US Departures". Foolishly I had tried to check in at the international terminal, only to find out that logic didn't prevail.