I solved this, to some extent, with AutoHotkey and figuring out what causes the de-pairing. This solution requires some seconds for re-pairing each time, but is fast enough to be a useful method.
The AutoHotkey code:
F2::
Run, C:\Program Files\Common Files\Logishrd\Unifying\DJCUHost.exe ; this is the Unifying connection program
WinWaitActive ahk_exe DJCUHost.exe,, 4
If !ErrorLevel
{
Sleep 160 ; 100 was not enough
Send {Enter}
TrayTip Re-pairing Logitech,To disconnect: pull dongle, hibernate or use a USB switch to disconnect the dongle
; As soon as you have re-paired, you can switch on (or re-insert or wake the computer with) the Unifying dongle to put it back into operation (it then waits for a missing pairing)
}
else
TrayTip Could not open the Unifying connection program,`n
Return
Basically that code is only opening the Unifying connection program, but speeds things up. The thing is to understand that the pairing is (temporarily) lost as soon as power is lost for the small Logitech Unifying dongle. Then, a new pairing can be done quickly. You can achive the required power loss by: 1) pulling the dongle out, 2) using a USB hub with simple toggle switches (or a KVM Switch), 3) putting the computer into hibernation, after which the dongle loses power (you can't have the dongle on a permanently powered USB hub for this to work, also just sleep might be enough if you set your computer to cut the power to the dongle during sleep). (There's also option 4, you can go to Logitech Unifying Software: Advanced, Un-Pair. But that can't be done blindly, though in some cases a script could do that un-pairing.)
So, using the option 2 or 3 is just more convenient than removing the dongle from the computer that needs to get un-paired, especially if your setup is like mine where the dongle is located in a hard to reach place.