Unable to run Bash 5 from launchd
Your script uses type to find the first instance of bash within PATH and then calls exactly that instance. So if /bin is before /usr/local/bin (or, more likely, /usr/local/bin isn't in PATH) the macOS version of bash is found and executed.
To check the version of the running shell use
echo $BASH_VERSION

instead.