[When Jacob saw that Esau was coming] he went ahead of [his family] and bowed down seven times until he reached his brother. (Gen. 33:3)

It says in Sefer Hakinuyim that Mordechai was the reincarnation of Jacob and Haman the reincarnation of Esau. Since Jacob did wrong by bowing before Esau seven times, Mordechai came and repaired Jacob's failing by refusing to bow down to Haman.

Jacob was guilty of giving a false impression….

[The question is:] how could Jacob, the most perfect of the patriarchs, bow down to the wicked Esau? He surely knew that it is forbidden to greet an evildoer.
[The answer is:] Jacob did not do anything wrong. When he prostrated himself he was bowing down to the Shechina that was coming to meet him.

Then why is it counted as a failing that needs rectification?

Jacob was guilty of giving a false impression to his wives and his children, causing them to think that he was bowing down to Esau.

Mordechai repaired this misstep by refusing to bow down to Haman.

[Translated by Avraham Jacob Finkel from Midbar Kasdimos, parashat Vayishlach; excerpted from "Kabbalah: Selections from Classic Kabbalistic Works from Raziel HaMalach to the Present Day" (Targum Press)]