Build flags not behaving as expected

I’m trying to set up the ini file so I can change what code is complied quickly and efficiently and came across this which is baffling me:

[platformio]
default_envs = PHOTON_V4

[env]
platform =teensy
framework = arduino
lib_deps = 
	fastled/FastLED@^3.6.0
	paulstoffregen/OctoWS2811@^1.5
	;duff2013/Snooze@^6.3.9
	thomasfredericks/Bounce2@^2.72

[env:PHOTON_V4]
board = teensy40
build_flags = 
	-D PROP=PHOTON_V4
	-D PROP_NUMBER=1

This works fine but when I move the -D PROP_NUMBER=1 build flag to [env] it stops evaluating the PROP_NUMBER macro in the code, as in this:

[platformio]
default_envs = PHOTON_V4

[env]
platform =teensy
framework = arduino
lib_deps = 
	fastled/FastLED@^3.6.0
	paulstoffregen/OctoWS2811@^1.5
	;duff2013/Snooze@^6.3.9
	thomasfredericks/Bounce2@^2.72
build_flags = 
	-D PROP_NUMBER=1

[env:PHOTON_V4]
board = teensy40
build_flags = 
	-D PROP=PHOTON_V4	

but if I move both build flags to the [env] it works again

Any insights would be greatly appreciated

This is documented behavior. Use interpolation.

https://docs.platformio.org/en/latest/projectconf/interpolation.html