How to wire two loads when one depends on the other?
Simple:
 Line Hot-----SwitchB----------SwitchA----
                        |                |
                      LoadB            LoadA
                        |                |
 Line Neutral-----------------------------

This does require switches (typically a normal wall switch) you can wire to - hacking into device B after a built-in switch is going to void all sorts of things, not the least of which is your insurance if it causes a fire after your modification.