Environment variables like $POSTGRES_PASSWORD are only processed if the container initialization is running on an empty database directory; otherwise the users and passwords that were previously in the database state are kept, and no new users are created and no passwords are changed. You should clear the cache in the /data directory, I.e. the /data directory on the host; what is mounted on /var/lib/postgresql/data in the container.
PS: Thanks for @David Maze for posting the comment that finally worked as a correct answer! I’m not familiar with the community and can only pay tribute in this way :( If there’re proper ways to cite this, please inform me.