The best way to explain President Obama's vanity is to examine his own words.
My favorite is this line from page 160 of The Audacity of Hope:I find comfort in the fact that the longer I’m in politics the less nourishing popularity becomes, that a striving for power and rank and fame seems to betray a poverty of ambition, and that I am answerable mainly to the steady gaze of my own conscience.
So popularity and fame once nourished him, but now his ambition is richer and he’s answerable not, like some presidents, to the Almighty, but to the gaze of his personal conscience. Which is steady. The fact that this sentence appears in the second memoir of a man not yet 50 years old—and who had been in national politics for all of two years—is merely icing.
Even if you think that, it's hard to imagine being so obtuse that you'd write it down for the world to see.