probably not your case, but do you run the command directly? something similar occurred to me when i created a custom command that (among other things) run the parallel tests as a Process. in that case the threads of the test command inherited the env from the main command (not taking phpunit/testing env into account) and messed up the things a bit. i fixed that by explicitely setting the env variables in the main command (https://laravel.com/docs/11.x/processes#environment-variables).
as i said, probably not your case, but might ring some bells