(As it is said, in Exodus 34:27:) "Write for yourself." The first tablets — I wrote them, as it is said (in Exodus 31:18): "written with the finger of God"; but the second ones — "you write for yourself." To what is the matter comparable? To a king who married a woman and wrote her a gamitos (that is, a marriage contract) at his own expense. She did nothing but corrupt herself, so he expelled her. Her bridal sponsor came and reconciled her to the king. The king said to her: "Behold, I have been appeased; only go and make another gamitos."
Why Moses Wrote the Second Tablets Himself in Ki Tisa
Midrash Tanchuma Buber, Ki Tisa 17:2
(שנאמר) כתב לך. הלוחות הראשונים אני כתבתי אותם, שנאמר כתובים באצבע אלהים (שמות לא יח), אבל השניים את כתוב לך, למה הדבר דומה למלך שנשא אשה וכתב לה גמיטוס (פי' כתובה) על שלו, לא עשה אלא קלקלה וטירה, בא שושבינה וריצה אותה למלך, אמר לה המלך הרי נתרציתי, אלא לך ועשה גמיטוס אחר.