Can you actually define the project name inside the compose configuration file itself, rather than as an environment variable or command-line flag? I suspect it may avoid some trouble in some scenarios.
I guess overriding that name might still be possible by env or flag.