First do what @Milliways wrote in his answer.
You are then in a command line shell where you type the following commands:
mv /home/pi/.bashrc /home/pi/bashrc.broken
mv /root/.bashrc /root/bashrc.broken
Then remove the init=/bin/sh at the end of cmdline.txt and reboot.
Your best option is to restore from your backup.
If your Pi won't boot you can repair by rebooting to a root shell.
Append init=/bin/sh at the end of cmdline.txt (which can be done on any computer) and reboot.
After booting you will be at the prompt in a root shell.
Your root file system is mounted as readonly now, so remount it as read/write mount -n -o ...
There is absolutely no difference between the reboot modes. You are just lucky. Any difference is likely to be external to the Pi.
DO NOT use rc.local (as advised in the hundreds of similar questions on this site).
It runs BEFORE all services are running.
The systemd WorkingDirectory= setting defines on which directory the service will be launched, same as when you use cd to change a directory when you're working in the shell.
That doesn't mean that all the other paths (including that from ExecStart=) will now be relative to it, so you still need to fully specify the path to your script in that directive: