This by no means an academic question. Based on the recent Pew Study on American Jewish life, we are making a hash of it: two-thirds of Jews born after 1980 see their Jewishness purely as an ethnic identity, with no moral/religious component at all.
Joseph's sons, Menashe & Ephraim, were remarkable young men. R' S.R. Hirsch suggests that, due to both good home-training and temperament, they steered clear of the corrupting allures and indulgences available to them as Egyptian courtesans. This personal moral accomplishment is all the more remarkable in light of a noteworthy Onkelos which says that as Viceroy, Joseph had to teach Torah to his sons in secret. (Genesis 49:24)
So in spite of having no contact with the Israelite clan in Canaan, and in spite of the hardships of living as crypto-Jews, they somehow figured out how to preserve the highest levels of Jewish ethical conduct in a very depraved Egyptian culture. For Rabbi Hirsch, Menashe & Ephraim are the exemplars of Torah Im Derech Eretz (the Ideal Synthesis of Torah and Worldliness).
Before we answer that question, I'd like to briefly outline two of the dominant teaching modalities that I have observed in Jewish education; as we shall see, each suggests themselves from Joseph's formative experiences in Egypt.
One way to teach Jewish boundaries is to simply impose them on the child; I call this the "Issur of Chov". The Issur of Chov is an issur of absolutism. It is imposed by a force extrinsic to self, and brooks no challenge to its authority. The Issur of Chov focuses primarily on compliance and conformity. Precisely because obligation is imposed from without, it emphasizes the externalities of keeping the mitzvot: very narrow definitions of appropriate dress, proper neighborhoods in which to live, proper friendships and associations, things that are very public and very measurable.
It focuses on phenotype, (defined in this context as) the outward manifestation of religiosity, the religious act. Because Chov cannot reach the life of the mind, it de-emphasizes it. This is the mindset that advocates "Mitzvah Ainah Tzrichah Kavanah," that intentionality is not necessary to do a mitzvah.(Tractate Brachot 13a)
Obedience, not insight, is the overarching educational objective. Kabalat Ol Malchut Shamayim is in the model of Har K'Gigit, meaning that the Jewish People were in a certain sense coerced to accept the Sinaitic Covenant (Tractate Shabbat 88a).
Thus Chov requires ever expanding levels of restrictions to both insulate it's adherents and protect the "purity" of it's Torah from dangerous foreign ideas. In defiance of the halakhah, new restrictions are piled on old restrictions, and machmirut (legal strictness) is the argot of Chov. It's worldview is self-referential, having no need to reality-test it's axioms. It is primarily the Torah of Yirah, Fear of Gcd.
The better, harder way I term the Issur of Reshut, i.e., of opting in to the Jewish belief system. The Issur of Reshut is expansive and liberating, not constraining. It begins from the place of unencumbered free will, recognizing that there is no authentic religious impulse in its absence. It seeks to cultivate a love of Torah and Mitzvot that is intrinsic to self.
Accordingly, intellectual inquiry is protected and cultivated; indeed, children are encouraged to ask their most deeply-held questions, most especially questions on the fundamentals of faith, the Yesodei HaDat. The Issur of Reshut focuses on genotype, on the development of inner character [middot tovot] and critical thinking skills. Outward manifestations of religiosity are less emphasized; when "organic" middot are in place, we find the chizoniut/externality takes care of itself.
This is the mindset that advocates "Mitzvah Tzrichah Kavanah," that intentionality is necessary to do a mitzvah.
Our daily prayers teach that every choice, no matter how seemingly insignificant, has profound moral consequences. The result of good decision-making is the life they experience in their home: a life of blessing/bracha, of inner peace/shalvat nefesh, of love of Torah/ahavat Torah, and of domestic tranquility/shalom bayit. The consequences of non-compliance are exactly the opposite. Kabalat Ol Malchut Shamayim is on the model of "Kimu v'Kiblu," meaning that the Jewish People opted-in to the Sinaitic Covenant. (Esther 9:27)
The Issur of Reshut emphasizes that ultimately, free will is the domain reserved exclusively for the individual, who must also bear the full consequences of his choices. It is primarily the Torah of Ahavah, of love of Gcd.
We see hints to these two divergent approaches in Joseph's experiences in Egypt.
This is the Joseph that bitterly screams the plaintive cry of a victim, "I've been done wrong! I'm innocent I tell ya!" (Genesis 40:15) He is the quintessential "Man of Fate" as described by Rabbi Y. B. Soloveitchik: a pawn of grand cosmic forces that he cannot possibly hope to fathom; a mere object in a cruel and uncaring world over which he has no control.
Joseph's earlier experiences in Potiphar's household correspond to the Issur of Reshut. As major domo of Potiphar's household, he possesses exceptionally far-reaching powers in the conduct of his world. He comes and goes as he pleases; he is rewarded for the application of his intrinsic strengths to the management of Potiphar's affairs: integrity, efficiency and innovative thinking. He has a framework, his Torah worldview, to understand the flawed and debased world in which he lives, and how his value system distinguishes him from others.
This is the Joseph that has the moral stamina to resist the irresistible seductions of Potiphar's wife. In Potiphar's house he evinces Rabbi Soloveitchik's "Man of Destiny," a person able to (at least in some measure) be the subject of his world, to mold it and leave his mark upon it.
Joseph makes peace with that reality. He must therefore find a modus vivendi to effectively synchronize the two worlds he cohabits. Moreover, as his sons mature, he must teach them this critical survival skill. Will he be the rigid didact, insulating them against their environment, or will he teach them his more nuanced shita/approach, contextualizing Egyptian society and defining their role in it, as he did in Potiphar's house?
Contrasting Educational Approaches
Issur of Chov has, as it's primary advantage, easily defined metrics for success. Based as it is on external behaviors, parents and educators in the Chov-based environment can easily measure compliance or non-compliance.
The Jewish world is reeling over the epidemic of Yeshivah-educated teenagers openly rebelling in Shmirat HaMitzvot. When Judaism is a spiritual prison/hesger nefesh for our children; when issur is chal al issur; when Halakhah is viewed as an obstacle to self-expression and self-fulfillment; can we expect otherwise? The surest way to get a teenager to do something is to forbid it.
Many people willingly opt-in to Chov-based societies, deriving much succor and security in the certitudes of Chov. For such people, the surrender of some of their personal autonomy to the commune is a reasonable price to pay for inclusion. Conformity thus replaces scholarship as the sine qua non of Jewish life.
We watch in revulsion as Va'adei Tzniut/Modesty Committees enforce the Issurim of Chov, punishing even the slightest deviation from the social "norm" with verbal abuse and broken bones. The Issur of Chov creates a societal exoskeleton of pseudo-Halakhah which produces these ineluctable results.
The biblical obligation to educate our children in Torah cannot - must not - be completely delegated to others; we must be continuously engaged in the ethical development of our children. That which we demand of them, they must see practiced in our lives: intellectual and moral integrity, consistency, balance, joie de vivre, passion for Tefillah/prayer, ahavat Torah, compassion to all of Gcd's creatures, a burning desire to do the Ratzon/Will of Hashem, and shalvat nefesh/inner peace. Like Joseph, we must make peace with being "Ivrim," living as strangers in a strange land; after all, we are History's consummate non-conformists.
(1) Torah Chazaka Hee - Torah was intended to be lived in the world - "Lo Bashamayim Hee" (Deuteronomy 30:11 ff.); it is strong, indestructible - Torah ainah mikabelet tumah; and as such it is our guidebook for successful living in the Greater World.
(2) You are strong; your teachers and parents trust in you to make life choices responsibly.
(3) Your faith is strong; answers to every question of faith can be found in the Torah. No subject is ever off-limits.
But ultimately, we cannot deny our children their free will; it is granted by Hashem, not by parents, Rabbanim, or society. Our job as parents is to guide them towards utilizing their free will, the power to literally create and destroy worlds, beneficently, as moral agents in the service of their Maker.