How can I migrate from Discourse Hosted to self-hosting

You do. I asked at the beginning of the year and got this answer from the Team.

“As part of our cancellation process, we generate a complete backup of your site, including all uploads, which will be made available for you to download”