You could use MgGraph instead. Like this:
$userId = "[email protected]" Invoke-MgGraphRequest -Method PATCH -Uri "https://graph.microsoft.com/v1.0/users/$userId" -Body @{onPremisesImmutableId = $null}