What is widely accepted to be the probable reason of Mahr. But that's not really accurate. Because from the evidences from the hadiths there is no way the Prophet would advice a lady to accept her husband teaching her the Quran as Mahr if it was intended to keep her secure should the marriage go bad or the man dies.