Interesting scenario.
I would enter information about country A in the Air Canada password information. That will (1) take you to Country A with no problem. (2) also take you back to country B.
However when checking in for the leg back from B to Canada, you give them the Canadian passport. At which point you are already out of A, but that will also allow you to reenter Canada.