The sefer Asifas HaKohen here says:
It seems to me that Rashi learned this from the gemora in Kiddushin 29b where there seems to be a dispute about whether a man should first learn Torah and then get married, or first get married and then learn Torah. The gemora concludes that there is no dispute in the matter, but rather the first way applies to those who live in Eretz Yisroel where earning a livelihood is easy and so being married will not interfere with a person’s ability to learn, and the second way applies to those who live in Bavel where earning a livelihood is hard, and therefore it is better to first go to learn before he has a millstone around his neck.
Now, when Ya’akov left Be’er Sheva he was very wealthy and could easily support a family. Therefore he was obligated to get married first. But later when Eliphaz took all of his money as Rashi explains in Bereishis 29:11, he no longer had a means of livelihood, and thus became
obligated to go and learn Torah first.
This is why Rashi explains here that the posuk means that he set out to go to Haran, because initially he intended to go straight to Haran to get married, but on the way he suddenly became unable to first get married, and so he went first to the yeshiva
of Shem and Ever.
Translation taken from here.