AFAIK there is no need for that, the Harmony will just “unplug” the device on demand, which is not the same as unpairing. A bluetooth device can be paired with multiple targets, of course it can only be active with one target at a time. For instance I have two devices in my activities where the Harmony Elite is paired via bluetooth: the Vero 4K+ and a Philips OLED TV. When I use the Vero the bluetooth keyboard is “removed” from the Philips TV and I can control the Vero via bluetooth. When I turn off the Vero it automatically connects back to the TV which actually then displays a “USB keyboard connected” message.
Anyway I recommend you have a look at my guide for using the bluetooth connected Harmony in an extended scenario at [HowTo] Start/Stop Kodi with your remote (headless mode) - #4 by Ambiled