It is not possible to create "example.com" domain if "subdomain.example.com" already exists, task Sync the DNS zone 'example.com' says:
Domain name conflicts with existing domain 'subdomain.example.com'
The restriction on creation of a domain after creation of a subdomain is the issue of the platform, its ID is TP-141598.
It should be resolved in the next release of the system.
You can apply the following workaround:
Backup subdomain's data and remove it.
Create domain "example.com".
Create subdomain "subdomain.domain.com".