That was idiotic, and he must have known it was going to blow up in his face. I don't agree with the way he's chosen to defend his actions there either - that would have been an easy one to hold his hands up to and just admit that it was a poor decision.
(Although, having said that, I'm not sure what I would have done in Mesut's shoes, especially if I still had any extended family back in Turkey, or harboured any hopes of ever moving there in the future? Erdogan doesn't seem like the kind of person who you easily say no to.)
That being said, the treatment he's received from the German press and the DFB clearly goes way beyond just the photo - the knives have been out, sharpened and ready for him for years, IMO (probably stemming from some loud-mouth at Bayern who took a dislike to him at some point - they usually seem to control the tone of voice for everything in German football), and Özil has stupidly given them the perfect opening to legitimise their discomfort towards his Turkish heritage. Very hard not to agree with some of the points he makes, and that there's no racist and discriminatory undertones to it.
The backlash to this is going to be get really vicious and spiteful now, you watch.