The Midrash opens Parshas Terumah with a mashal: A king had an only daughter that was about to get married. The king loved his daughter dearly and could not bear to part with her. He begged her groom, “Please, make a small room in your home so that I can come and be with you.” So too, Hashem could not separate himself from the Torah that he wanted to give to us. Therefore, he requested that we build a Mishkan so that he could be with us.
R’ Chaim Ya’akov Goldvicht, the R”Y of Kerem b’Yavneh whose yahrzeit is today, pointed out that the mashal does not fit the nimshal. In the mashal, the princess' marriage brings about her separation from her father, the king. Hashem certainly did not give us the Torah so that we should separate from him! Why should we need a mishkan to retain that closeness to Hashem after kabbalas haTorah?
The answer may be found in the brachos in Parshas BeChukosai. “V’nasati mishkani b’sochichem, v’lo tigal nafshi eschem. V’halachti b’sochichem v’hiyisem lachem l’Elokim.” (VaYikra 27). At first glance these two pesukim seem to be just poetic repetition of the same idea. The Seforno, however, reads them as two different concepts: When you have sinned, then my Mishkan will be there with you, "V'nasati mishkani b'sochichem," so that the Shechina will not be disgusted by you, "V'lo tigal nafshei eschem." However, that is not the ideal. “V’halachti b’sochichem,” the ideal is for Hashem to dwell amidst Bnei Yisrael without a Mishkan, “V’hiyisem lachem l’Elokim,”in full appreciation and acceptance.
According to many Rishonim the construction of the Mishkan was a response to the cheit ha’eigel. This is the idea our Midrash is reflecting. Bnei Yisrael had moved away (so to speak) from Hashem through their sins and could not remain on the plateau attained at ma'amad Har Sinai. Therefore, Hashem asked that we create a Mishkan so that he could still dwell among us. [see Pri Tzadik of R' Tzadok haKohen, first piece in the parsha for a similar idea.]