Circular dependency between S3 storage and Keycloak Provider when upgrading to 0.13

I have a terraform 0.12 project that uses the Keycloak provider and stores its terraform state in an S3 bucket. Now I’ve tried to update this project to terraform 0.13. It worked fine locally with “terraform.tfstate” but when trying to update the real installation I wouldn’t let me:

If I first try to upgrade the Keycloak plugin name it tells me that it cannot access the S3 storage yet:

 $ terraform state replace-provider mrparkers/keycloak
Backend reinitialization required. Please run "terraform init".
Reason: Initial configuration of the requested backend "s3"   indent preformatted text by 4 spaces

If I first try to run “init” it can access the S3 storage, finds a reference to an unknown Keycloak 1.2.0 module there and does not know how to download it. Please note that my configuration already declares a dependency to keycloak-provider 2.2.0:

$ terraform init
Initializing modules...
- dev_realm_srt in ../../modules/realms/SRT
Initializing the backend...
Successfully configured the backend "s3"! Terraform will automatically
use this backend unless the backend configuration changes.
Initializing provider plugins...
- Finding hashicorp/keycloak versions matching "~> 1.20.0"...
- Finding mrparkers/keycloak versions matching ">= 2.2.0"...
- Finding latest version of -/keycloak...
- Installing mrparkers/keycloak v2.2.0...
- Installed mrparkers/keycloak v2.2.0 (self-signed, key ID C50867915E116CD2)
Partner and community providers are signed by their developers.
If you'd like to know more about provider signing, you can read about it here:
Error: Failed to install provider
Error while installing hashicorp/keycloak: provider registry does not have a provider named
Error: Failed to install legacy providers required by state
Found unresolvable legacy provider references in state. It looks like these
refer to in-house providers. You can update the resources in state with the
following command:
    terraform state replace-provider

Any ideas how to resolve this?