>>14377062Mexico declared its independence from Spain due to legitimacy problems with the Spanish throne, and later went on to have wars with the US as an independent nation.
Canada was basically the opposite, and only went to war with the US under British rule (though in response to domestic aggression) and gained its autonomy through lawful process instead of revolt.
Basically, Canada had far longer to suckle on the teat of its founders and gain stability while Mexico was forced to fight for itself over a hundred years earlier.