Can't add --dont-append-digest flag to ElfToBin using extra_scripts

I need to add the --dont-append-digest flag when running elf2image. I tried using the following extra script but it doesn’t change the flags at all.

no_hash.py:

from copy import deepcopy

Import("env")
Import("projenv")

action = deepcopy(env["BUILDERS"]["ElfToBin"].action)
action.cmd_list = env["BUILDERS"]["ElfToBin"].action.cmd_list.replace("0xb0", "0xb0 --dont-append-digest")
env["BUILDERS"]["ElfToBin"].action = action

print(action)
print(projenv["BUILDERS"]["ElfToBin"].action)

I took inspiration from where a very similar thing is done here:
https://github.com/espressif/arduino-esp32/blob/bde2d643eca430b6cae3f1487eeba9a0c9732076/tools/platformio-build.py#L250

I can see that the flag is, to my knowledge, properly appended from the two print statements. They both print the same thing:

"$PYTHONEXE" "$OBJCOPY" --chip esp32 elf2image --flash_mode ${__get_board_flash_mode(__env__)} --flash_freq ${__get_board_f_image(__env__)} --flash_size 4MB --elf-sha256-offset 0xb0 --dont-append-digest -o $TARGET $SOURCES

But the command that ultimately ends up running doesn’t reflect the changes.
As report by pio run -v:

"/home/user/tuf/firmware/.venv/bin/python" "/home/user/.platformio/packages/tool-esptoolpy/esptool.py" --chip esp32 elf2image --flash_mode dio --flash_freq 80m --flash_size 4MB --elf-sha256-offset 0xb0 -o .pio/build/featheresp32/firmware.bin .pio/build/featheresp32/firmware.elf

I can also confirm that the digest is still appended by checking with image_info so it isn’t just pio run -v reporting the wrong command.

For completeness, here is platformio.ini:

[env:featheresp32]
platform = espressif32
board = featheresp32
framework = arduino
monitor_speed = 115200
board_build.filesystem = littlefs
extra_scripts = pre:extra_script.py, post:no_hash.py
lib_deps = bblanchon/ArduinoJson@^7.1.0

and extra_script.py:

Import("env")

# include toolchain paths
env.Replace(COMPILATIONDB_INCLUDE_TOOLCHAIN=True)

extra_script.py comes from https://docs.platformio.org/en/latest/integration/compile_commands.html

I appreciate any guidance anyone might have on how to achieve this.

If --dont-append-digest can’t be added the way I am trying to do it, is there another way to automatically convert the elf to an app image without the digest with platformio? Right now I am stuck doing that step manually.

Thanks,
Scous