The issue turned out that the login flow is interrupted because the second HTTP request usually goes to a different container than the container that delivered the wp-login.php
login form.
The solution is to turn on Sticky Sessions for the AWS Application Load Balancer (ALB) Target Group that serves the Fargate containers.