Varables are not available in the bash profile. In line with the documentation the shell executor runs the bash profile, however it would seem that variables are not available until they are piped in by the command line used by the shell executor, which is after the shell starts and after it has executed its profile.
cat generated-bash-script | /bin/bash --login
I don’t know if this would be considered a bug, a “feature”, or if the documentation should just clarify this point.
I opened an issue for this.