To some extent, Turkey and Mr. Erdogan are victims of their own success, having created an attractive investment climate that brought in billions in dollar-denominated lending, particularly after the financial crisis of 2008.