It is a curious fact that until the early Jews left Egypt, nobody became a Jew – either you were born a descendant of Avraham, Ytzchak or Yaakov, or you were simply not Jewish. For all the outreach that Avraham did, he did not make anyone else Jewish. There was no nation of Israel – there was a tribe.
The very notion of “joining” Israel did not even seem to occur to anyone Avraham or Isaac encountered. How can someone join a tribe, after all? The answer is that there is a way: one can marry into a tribe, and become an adopted member. And we were introduced to the first person who tried to do this: Shechem, living in the eponymous place, desired Dinah. Shechem took her, and fell madly in love. He was willing to do anything to marry her – and he almost managed it. The brothers tricked Shechem, and ended up murdering everyone in the town.
But Shechem almost made it! He was the first non-Jew born who wanted to become a member of the tribe, and had he gone about things differently, it is possible that Shechem would have been the first welcomed convert to Judaism.
Shechem has an alter-ego – Yosef. Shechem was the outsider who almost go in, while Yosef was the insider, who was almost kicked out. And the Torah gives us explicit connections between the two: when Yaakov sends Yosef out to find his brothers, he sends Yosef to Shechem. That act changed his life forever (we might go so far as to suggest that Yosef’s exile was almost Shechem’s middah kneged middah to Yaakov for the acts of his sons).
There is a midrash that Yosef’s wife is the daughter of the relationship between Shechem and Dinah – so Shechem may even have been Yosef’s father-in-law as well as his erstwhile brother-in-law.
And of course, Yosef’s bones were the only ones of the brothers to be buried in Israel — in Shechem! There is a strong connection here that cannot be ignored.
I’d suggest that the differences between Yosef and Shechem answer the question of why Shechem was rejected, and why Yosef was ultimately reunited with his family. There was nothing wrong with desiring Dinah – love and desire are perfectly normal, and even beautiful, feelings. The difference is that Shechem did not woo Dinah – he took her first, and loved her later.
Yosef, in two separate instances, separated himself from Shechem. In the first place, when offered the opportunity to follow his lust, Yosef restrains himself. In the moment of truth, Yosef mastered his flesh, and Shechem did not do so.
The second thing is that Shechem’s act of taking Dinah disqualified him. Yosef, whatever his other faults may have been, never took something that was not his. The Torah tells us that when Yosef married, he did not “take” a wife, as is the common expression in the Torah. Instead, he was given his wife by Pharoah.
Yosef, by controlling his desires and respecting other people, ultimately earned his reunification with the family – while Shechem’s acts disqualified him.