The imports happen in a very specific order. And in my case, I created a custom homepage that should only be visible to users with a certain role.
So I created a new custom role and custom homepage on my test environment. And then created an export package.
Overview of the export functionality:
Be aware that this does not represent the order of import.
Example from an import below but note that I didn't need to import everything so Script, Media Processing and some others aren't shown here:
You can see that portal_pages is above policies. Policies contain the user groups.
So if you have pages that depend on a UserGroup, you will run into errors when importing the package when that UserGroup doesn't exist yet.
Where the failure states this error:
It was as easy as to reimport the same package a second time. It finished importing the policies the first time so it could continue with the portal pages and find the necessary references.