You can set a shutdown-script metadata in GCP, that will run upon instance shutdown:
https://cloud.google.com/compute/docs/shutdownscript
This used to work in CoreOS, but with Flatcar the script is not triggered.
Could be related to #737 and #738 - but I'm not sure if that is what's missing.