Exporting DYLD_INSERT_LIBRARIES for libgmalloc not working on Big Sur?
On my (M1) machine:
~$ export DYLD_INSERT_LIBRARIES=foo
~$ env | grep DYLD_INSERT_LIBRARIES
~$ /opt/homebrew/bin/bash
dyld: could not load inserted library 'foo' because image not found

Abort trap: 6

So (as you saw), the variable is being set - but since env is a system binary, it is silently removed. Testing with my homebrew installed version of bash, you can see the value is actually set.
See also this StackOverflow answer.
TL;DR works fine for non-system binaries, silently removed from the environment for system binaries.