This is an unfortunate aspect of the Cognito API, and is somewhat surprisingly also true in CloudFormation and in Terraform.
I spent some time a few months back trying to fix this - and I believe it is possible to fix in both Pulumi and Terraform - but I wasn’t able to finish up the work at the time. If you open an issue to track this, I’ll see if I can dust that work off.