Canada has no term limit. Leaders stay on until they have lost the support of their party.
Often that happens after a devastating election loss.
In this case it is happening because of his extreme unpopularity before the election and his parties hope of improving their election prospects under a different leader