McGraw-Hill's Dictionary of American Slang and Colloquial Expressions includes this entry:
thank you very much phr.
a (sometimes sarcastic) tag added to a statement for emphasis. (Often used when there is really nothing to thank anyone for.)
I will manage somehow to find my own way out, thank you very much.
In both your examples, the emphasis shows how proud the speakers are.
The same expression can also be used to indicate that someone has said or done something wrong:
(a tourist to a local) I'm Canadian, not American, thank you very much!
(a teacher to a student using a cell phone) You'll stay off your cell phone in class, thank you very much!
NOTE: In pretty much all contexts, the phrase comes off negatively. In your two examples, it sounds like bragging. In my first example, it's a passive-aggressive claim of offence at nothing serious. In my second example, the teacher is being unnecessarily rude.
If someone is simply correcting someone else, they might use "Actually, I'm Canadian" or "Close, I'm Canadian". If someone is actually offended by the mistake (as opposed to claiming offence in order to put someone else down), they would show it in a different way.