Shutdown script doesn't run if workstation is not connected to the network

It's by design. Microsoft never said that the startup/shutdown scripts will be executed when the computer is offline.

The local cache you found is not there for offline processing, but to avoid that the clients overwhelms the domain controllers. You can find more details about this particular point here: Group Policy Core Protocol: Cache of GPO Version

Additionally, the Group Policy Script Extension requires that the client must be able to validate the source of the script. And as you can see on the following diagram, the GP Server (Domain Controller) is the core of the Group Policy Scripts Extension:

https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-gpscr/ms-gpscr_files/image001.png

In order to solve your problem, I suggest you to try this instead:

Create a Scheduled Task via Group Policies Preferences (Computer Configuration -> Preferences -> Control Panel -> Scheduled Tasks) and create a New Scheduled Task (at Least Windows 7), configure the task to run as System, add the following trigger: On disconnect from user session.

Then, create another Preference ("File" instead of "Scheduled Task") to copy your script in a secured local path on the computers (the users must not be able to write in this file to avoid privilege escalation). You can use something else to copy the file if you want, but don't forget to reference it in the Scheduled Task Preference.