This is a common problem I see a lot at my current job and the only advice I can give you is just say no. If you must use something akin to system() there are tools bash provides like:
printf -v quoted %q "$my_shell_crud"
Or
printf %s "${my_shell_crud@Q}"
This problem exists in other unfortunate and unlikely places like: