I switched my interactive shell to zsh on all my machines.
My script did no longer work correctly even though the script invoked bash (Apple’s old bash).
It's unlikely that the first event has caused the second. In other words, if you were to do all the same things all over again but *not* switch your interactive shell to zsh, the bash script would still stop working. My guess is that you've upgraded macOS, which in turn has caused bash to downgrade from 5.x to 3.3.
So now I am happy that my script works on all my machines.
I'm glad. If some of your machines are expected to have bash over 10 years old, it's reasonable to avoid invoking bash in your scripts. I sympathise. I happen to maintain a few POSIX shell scripts and macOS has really been a bane with its /bin/sh symlinked to bash 3.3. Writing workarounds for bash bugs fixed over a decade ago is frustrating.
Roman.