How do I make this bidirectional switch work with inductive and capacitive loads?
It has to be done in the control unfortunately

Bidirection switches like that are used for Matrix converters all the time (will IGBT mind...)

The two golden rules: 


THOU SHALL NOT OPEN-CIRCUIT THE LOAD
THOU SHALL NOT SHORT-CIRCUIT THE SUPPLY


which results in very good monitoring to ensure correct commutation. Equally such bidirectional switches take in essencially 3 commands


SWT A on
SWT B on
BOTH switches OFF 


At the moment, your topology only provides #3 and a hybrid of #1 and #2