This is probably becuase the headphones have a bug that can be exploited - normally this should not be possible at all.
JBL does have an app (at least for my android), so I would recommend getting that and checking for any firmware upgrades.
Other then that there isn't probably any easy way for you to prevent it (well except for the wired-only mode as you say - through lighting to jack and female jack to usb-c cables).