The president of Turkey is coming to realize through hard experience that nationalist posturing results in poor foreign policy.