I would like to add to this question. I've ran into the issue in K11 of my canonical tag also not showing the www prefix. My original solution was to just update the site domain name in the Sites Application, however, that then triggered a licensing warning, since the license was registered without the prefix.
I am implementing the canonical as so in the masterpage:
<link rel="canonical" href="{%CurrentDocument.AbsoluteURL.Replace("/en-us/", "/") #%}" />
This spits out https://domain.com/pagename but I need it to say https://www.domain.com/pagename