Cannot upload build with nobuild set unless PLATFORMIO_BUILD_FLAGS match

I want to be able to build my application in one of 3 different configurations, and then upload to a device later from within a docker container. I can see no reason for the upload logic to be aware of which of the 3 configurations was used to build the software, and I’d like to keep it agnostic.

I customise the build by passing in some build flags using PLATFORMIO_BUILD_FLAGS:

export PLATFORMIO_BUILD_FLAGS="-DSOME_FLAG -DSOME_OTHER_FLAG"
pio run -e app

This works just fine, and if I upload the binary from the same context with:

pio run -e app -t nobuild -t upload --upload-port /dev/ttyACMx

it will upload no problem.

However, if I try to run the upload from somewhere PLATFORMIO_BUILD_FLAGS isn’t defined, or does not match what it was at build time, my build artefacts are deleted:

export PLATFORMIO_BUILD_FLAGS=""
pio run -e app -t nobuild -t upload --upload-port /dev/ttyACMx

and the upload will fail with a message like:

*** [nobuild] Source .pio/build/app/firmware.bin' not found, needed by target nobuild’.

So my question is:
Is there a way to tell pio to just upload the app. Not to check checksums, or build flags or anything. Just upload the binary?

thanks for reading