Small nitpick, LD_PRELOAD will override the write() function from the libc, which is a wrapper around the system call, not the write system call itself.
This is significant for programs written in Go, which tends to make system calls directly instead of using the libc wrapper functions. LD_PRELOAD trickery often doesn't work with Go programs for this reason.
On macOS, Go just straight up prevents the use of DYLD_INSERT_LIBRARIES (the equivalent of LD_PRELOAD), because macOS runs dyld and this mucks with some sort of threading setup.