Magical suggestions you find on the web often don't work and there is no reason why this bizarre approach would work.
What happens if you get rid of the static IP address and strange script?
Most of the script is operating on the obsolete Debian networking which is not used in Raspberry Pi OS.
If it doesn't work on Pi3+ and Pi4 the most likely cause is ...
I ran into this issue recently, my old Raspberry Pi became my FreeRadius server and so I set it up with a static IP.
The relevant information from PhillipB's Python script turned out to be running ip addr flush on the interface in question, eth0 in my case. Just restarting dhcpcd.service didn't help.
So here's the simplified solution in my case:
I suggest that rather than trying to set a static IP Address you request the DHCP server to assign a predictable IP Address. See https://raspberrypi.stackexchange.com/a/121830/8697
The Pi WILL "work out of the box" - it is designed to use DHCP.
The values you are are attempting to assign seem to be inconsistent with your router, but you haven't ...
The host machine was using the same port which was the reason why it did not work. The suggestion by Andrew to use curl "http://127.0.0.1:8384" returned output just fine on the raspberry pi.
The solution was to start an ssh instance and forward the port like this:
ssh -L 8000:localhost:8384 email@example.com
This made the syncthing instance ...