Hoe kan ik migreren van Discourse Hosted naar zelf hosten

This is supported and should work fine.

Myself I’m not sure how the backup interacts with the defined functions… possibly it assumes they already exist in the discourse_functions schema.

Do you have this plugin (discourse-post-voting) installed? Try installing it prior to doing the restore.