וַיִּקְרַע יַעֲקֹב שִׂמְלֹתָיו, וַיָּשֶׂם שַׂק בְּמָתְנָיו; וַיִּתְאַבֵּל עַל-בְּנוֹ, יָמִים רַבִּים
And Jacob rent his garments, and put sackcloth upon his loins, and mourned for his son many days
Rashi says (loose translation by me):
"ימים רבים" - כ"ב שנה משפירש ממנו עד שירד יעקב למצרים [...] כנגד כ"ב שנה שלא קיים יעקב כבוד אב ואם
"many days" - 22 years since he left him until Yaakov emigrated to Egypt [...] against 22 years that he didn't honor his father and mother
Why did Yaakov deserve that punishment? After all, not only were his life in danger, but also he was commanded by both his parents to go abroad!
More details and sources:
וַיִּשְׂטֹם עֵשָׂו, אֶת-יַעֲקֹב, עַל-הַבְּרָכָה, אֲשֶׁר בֵּרְכוֹ אָבִיו; וַיֹּאמֶר עֵשָׂו בְּלִבּוֹ, יִקְרְבוּ יְמֵי אֵבֶל אָבִי, וְאַהַרְגָה, אֶת-יַעֲקֹב אָחִי.
And Esau hated Jacob because of the blessing wherewith his father blessed him. And Esau said in his heart: 'Let the days of mourning for my father be at hand; then will I slay my brother Jacob.'
And you can see that even after all of these years, Yaakov still had the fear that Esav is waiting for the revenge (Bereshit 32:8-9)
וְעַתָּה בְנִי, שְׁמַע בְּקֹלִי; וְקוּם בְּרַח-לְךָ אֶל-לָבָן אָחִי, חָרָנָה.
Now therefore, my son, hearken to my voice; and arise, flee thou to Laban my brother to Haran;
This mitzva should have been in effect until Rivka sends Yaakov a message to come back (see Bereshit 27:45), a message never mentioned to be sent.
וַיִּקְרָא יִצְחָק אֶל-יַעֲקֹב, וַיְבָרֶךְ אֹתוֹ; וַיְצַוֵּהוּ וַיֹּאמֶר לוֹ, לֹא-תִקַּח אִשָּׁה מִבְּנוֹת כְּנָעַן. ב קוּם לֵךְ פַּדֶּנָה אֲרָם, בֵּיתָה בְתוּאֵל אֲבִי אִמֶּךָ; וְקַח-לְךָ מִשָּׁם אִשָּׁה, מִבְּנוֹת לָבָן אֲחִי אִמֶּךָ.
1 And Isaac called Jacob, and blessed him, and charged him, and said unto him: 'Thou shalt not take a wife of the daughters of Canaan. 2 Arise, go to Paddan-aram, to the house of Bethuel thy mother's father; and take thee a wife from thence of the daughters of Laban thy mother's brother.
Only Yitzchak command was maybe fulfilled after the first 7 years at Laban's service, as he married Leah (Rachel's time of marriage is off-topic). It still doesn't sum up to 22 years...