the "US Boarder" is in the Canadian airports. Which means, you don't clear custom when you're in SLC. However, the airline will check your travel document, aka passport & green card, Canada visa, etc. before you're allowed to board the flight. You'll leave the US and enter Canada AFTER you land in the YVR.
Same when you leave YVR to a US destination. You clear the US custom in the Canada airport, then enter a "US territory" inside the Canada airport before getting on your flight. The custom agents are US citizen and live in Canada as a diplomat. Met one from Provo last time I was in YVR. He noticed the BYU shirt that I was wearing.