Great stuff!! I was just reading into this topic.
There might be a better way to do this, with the help of the newly added environment variable that runs a script after port forwarding: https://github.com/qdm12/gluetun/pull/2399
The solutions towards the end of the PR are especially neat
VPN_PORT_FORWARDING_UP_COMMAND=wget --retry-connrefused --tries=6 -qO- --post-data=json={\"listen_port\":{{PORTS}}} http://127.0.0.1:8080/api/v2/app/setPreferences