The correct answer, modified from the support answer.
(Note that this is correct w.r.t. "How can I make it so the DYLD_LIBRARY_PATH is passed to Matlab on Mac", for me it still isn't the full answer, because the library still fails to run through the matlab clib)
This happens because of System Integrity Protection on Mac computers running macOS version El Capitan (10.11) or newer. This security feature strips the "DYLD_LIBRARY_PATH" environment variable when launching protected executables. To work around this, instead of an “export” command, set the variable as part of the same line where the command is:
DYLD_LIBRARY_PATH="<path here>" <your command here or full path to executable>
For example, to launch MATLAB and pass in a custom "DYLD_LIBRARY_PATH" (the full path to your MATLAB executable could be different depending on your install location), you could run:
DYLD_LIBRARY_PATH="<path here>" /Applications/MATLAB_R2023a.app/Contents/MacOS/MATLAB
Please note that it's the path to the actual UNIX executable and not the ".app" file.
To make it more in line with the example in the matlab documentation, and to do have the export command still there (so the variable is available in other shells that do not launch protected executables), and because <path here> may actually be a very long line, you'd put this in two lines:
export DYLD_LIBRARY_PATH="<path here>"
DYLD_LIBRARY_PATH="${DYLD_LIBRARY_PATH}" /Applications/MATLAB_R2023a.app/Contents/MacOS/MATLAB