I can see that happen if the script is run with Bash 4.3.30, but not with Bash 4.4.12. (The version of the shell running the script doesn't seem to matter that much.)
I didn't bisect that any further, but there's this in the changelog that looks like it might apply:
This document details the changes between this version, bash-4.4-rc1, and
the previous version, bash-4.4-beta.
i. Fixed a bug that caused background processes run from non-interactive shells
with job control enabled to place the terminal in the wrong process group
under certain circumstances.