British troops burned down the White House not Canadians.
Well Canada was the United Kingdom. I'm sure some Canadians enlisted.
Remember, this was only 36 years after American independence and Canada was still a colony. Its population consisted of a lot of French and English colonists, but it also was populated by a huge number of 'Loyalists' who were former American colonists remained loyal to The Crown and fought for the British during the Revolutionary War. When the war ended, the Loyalists expelled from the new United States with little more than the shirts on their backs. A small portion returned to England, but a majority of them travelled north into Canada.
(My direct ancestor was one of them to do so. The rest of his family, who fought for the Patriots, remained behind. Families often divided their sons to fight for either one or the other. That way, there would always be one on the winning side.)
The Loyalists were well suited to fighting and were backed up by British soldiers who had been stationed in Canada. They hardly constituted an army, which is why the colonists did most of the fighting since a majority of the British soldiers remained behind to defend the colonists.
On top of that, the Natives of Ontario took up arms with the colonists and helped to defend their lands. They didn't care for the same thing to happen to them as happened south of the border.
So, in effect, it was Canadians who burned down the White House.
Following the War of 1812, people in Canada began negotiations with England to become a self-governing nation. The process was slow even though England wasn't averse to the idea. It would relieve the burden of trying to protect such a huge land mass. The process sped up immensely following the American Civil War and the threat to Canada became a serious reality.
So, it is because of 2 American wars that Canada became a nation.
Oh, and one more thing: Canada remains the only nation in the world to win a war against the United States.