Why was Yaacov punished for hiding Dinah from Esav? Isn't this an expected attitude from a loving and protective father?
another source in Mesilat Yesharim ch.4
And expounding on "it is very stormy round about Him" (Ps.50:3) - "this teaches that the Holy One blessed be He scrutinizes judgment on His pious ones to the degree of a hair's breadth" (Yevamos 121a)...
Yaakov, for replying angrily to Rachel when she said to him "give me children", the Midrash reports (Genesis Raba 71:10): "the Holy One blessed be He, said to him: 'is this how one answers a distressed person? By your life, your sons will stand before her son'.
And for hiding his daughter Dina in a box so that his brother Esav would not take her as a wife, even though his intent was certainly good, but nevertheless for merely witholding kindness from his brother the Midrash reports: "the Holy One blessed be He said to him: 'He who withholds kindness from his fellow..' (Job 6:14). You did not seek to marry her to a circumcised? Behold she will be married to an uncircumcised. You did not seek to marry her in a permitted way? She will be married in a forbidden way".
this says that
his fault was extremely fine (to a "hair's breadth")
his intent was certainly good
nevertheless, since he withheld good from his brother, he was punished for that.
could be he was fully justified but nevertheless was punished as we find Yaakov was punished for not doing the mitzva of honoring his parents for the 22 years he was in Charan (Yosef disappeared for 22 years) even though he was commanded by his own parents to go there.
It's a reasonable question. How could Yaakov Avinu do that to his daughter, giving her to an unworthy brother? But - we have an explicit gemara where someone did exactly the same thing. https://www.sefaria.org/Bava_Metzia.84a.12?lang=bi&with=all&lang2=en
Rabbi Yoḥanan said to [Reish Lakish, who was at that time an armed robber and apparently a rapist]: If you return to the pursuit of Torah, I will give you my sister in marriage, who is more beautiful than I am. Reish Lakish accepted upon himself to study Torah.
How could he do such a thing? Well, I guess Rabbi Yochanon thought that he was able to handle the situation, and make sure that Reish Lakish would progress properly to the point where he would be a worthy mate for R' Yochanon's sister. And his sister was so beautiful that it would motivate Reish Lakish to do it.
Perhaps Yaakov Avinu could have done the same. His daughter Dinah was extraordinarily beautiful. All by herself she eventually got the ruler of a city to get the entire city to circumcize themselves! She had power, and perhaps Yaakov could have used that power to help his brother come back. If not as a brother, then perhaps in a subordinate position as son-in-law. It would have been difficult, but it was his brother. Maybe he could have saved him.
He chose not to risk it, and Chazal are suggesting that he made the wrong choice.
Chiddushei Halev Esther 4:1
והנה אמרו חז"ל שיעקב נענש בעונש חמור שנאנסה דינה משום שמנע חסד מעשו ולא השיא את דינה לעשו והקשו בעלי המוסר מהדורות הקודמים למה נענש יעקב והרי בודאי שיעקב הי' מחוייב לעשות כן להשתדל בכל כוחו למנוע את בתו הצדיקה להנשא לעשו הרשע
ותירצו שהגם שיעקב הי' מחוייב להתנהג כן כדי למצוא את השידוך הטוב ביותר בעד דינה מ"מ הוא נענש משום שלא הצטער על זה שהוא אנוס ואין בידו לגמול חסד לעשו
And behold the Sages say that Jacob was punished with a harsh punishment, that Dinah was raped, because he withheld kindness from Esau and did not marry Dinah to Esau. And the Mussar Masters of the previous generations asked: why was Jacob punished? Certainly Jacob was obligated to do this, to try with all his might to prevent his righteous daughter from being married to Esau the wicked.
And they answered that notwithstanding that Jacob was obligated to act this way, in order to find the best match for Dinah, he was nevertheless punished because he was not pained about this that he was forced and he had no ability to provide kindness to Esau.
The Torah Temimah (to v. 15 § 9) has, to be honest, a quite surprising answer to this question:
ומה שכתב רש"י שנענש יעקב על שמנע את דינה מעשו שמא תחזירנו למוטב, צריך באור, היכן מצינו כהאי גונא, שיהא חובה על אדם למסור את בתו לרשע שמא תחזירנו למוטב, והלא כנגד זה יש חשש שמא יחזירנה הוא לרשעה, ואפשר לומר דבזה לא הי' יעקב מסופק שהיא תחזירנו למוטב, אך מפני זה גופא לא רצה להשיאה אותה לו כדי שלא תחזירנו למוטב, כלומר שמשנאתו אותו לא הי' רוצה זה גופא שיחזור למוטב, ויהי' לפי"ז באור הלשון ברש"י שמא תחזירנו למוטב, כלומר שעל כן לא השיאה אותה לו שמא תחזירנו למוטב, ובזה לא הי' חפץ, ולכן נענש. –
That which Rashi writes that Yaakov was punished for preventing Dina from marrying Eisav, lest she help him improve his ways, requires clarification. Where have we seen such a thing, that a person would be obligated to give over his daughter to a wicked person, lest she help him improve his ways? Behold, opposite this, is the concern that he might make her wicked!
Perhaps we can say that Yaakov had no doubt that she would turn him around. However, this was the exact reason why he didn't want her to marry him, so that she will not help him improve. Meaning, due to his hatred of him, this itself he didn't want, that he'd improve his ways. According to this, this will be the explanation of Rashi, who wrote "perhaps she will help him improve", meaning this is why Yaakov didn't marry her to him, lest she help him improve. This is something he didn't want, which is why he was punished.
I honestly find it hard to believe this is even permissible for someone to say. But what can I do, it's in print and in almost every Beis Midrash.
The Tolna Rebbe comments on the fact that Yaakov Avinu locked the box. What was the purpose of the lock? Surely Eisav wasn't expected to rummage through all the boxes?
He explains that the lock was to keep Dinah in against her will if need be. Dinah took this as an insult that she was also not to be trusted. That feeling burned within her. Therefore, she accustomed herself to go out and explore out of resentment that she was not trusted by her father. This resulted in Shechem being able to take her.
I have also heard, that others in Yeshivah explain (no specific source) that Yaakov Avinu's attitude was judged to be a bit too extreme. It was for this extra "nose in the air" assumption that his brother was unsalvagable, that he was held accountable by Hashem.
However, the general idea that he wanted to protect Dinah from Eisav was a proper idea of course.
I hope this helps. :)