Forced into battle against Islamic State as it presses on Turkey's borders, President Tayyip Erdogan is seizing the chance to keep another foe in check, bombing Kurdish militants he sees as a threat to the integrity of the Turkish state.