Hilchot Maachalot assurot 17:28
Even though the court is not obligated to separate a child (from eating forbidden foods or violating Shabbat), there is an obligation for the parent to disparage it and separate him in order to train the child in restraint and moderation (Kedusha ), as it says “train the child according to his way…” (Mishlei 22:6)
Rav Makbili suggests that the Rambam is reading this pasuk differently than most commentators. Most commentators understand “his way”, as referring to the way of the child (which would then mean either according to his personality, or at the beginning of his path i.e. early in life)
However, the Rambam understands “His way” as referring to the way of Hashem. The Pasuk is teaching us that if we want to raise children to follow the ways of Hashem, we must start that training young, even before there are any obligations or prohibitions for the child.
What are these ways of Hashem. The Rambam explains in Hilchot Deot, that the good and straight way to live is in following the ways of Hashem. The Torah commands this “you should be moderate (Kadosh) , as I, Hashem your God, is moderate”. The way of Hashem is to follow a balanced ethical personality, living wisely in all domains. Moderation means that neither extreme controls you, and that you are free in each situation to respond to the reality in front of you, not limited by your preexisting scripts.
The only way to inculcate these virtues (if we don’t have them as an inborn habit) is through repeated deliberate practice. This practice can uproot bad habits, but it is much easier to establish a new habit than to uproot an old one. Unlike specific behaviors, like discrete mitzvot, which are relatively easy to take on later in life, character traits are much more difficult to change. If our children develop bad habits and traits they are likely to remain throughout life, and if they develop good character while young, that will also remain throughout life.
If a child transgresses one of the specific Mitzvot the courts don’t get involved since there isn’t a legal obligation for the child. But since many Mitzvot train us in these virtues (even though they are not identical with them) and provide a heuristic for acting virtuously, the parent should use them to help the child develop the virtues.
When deciding how to raise our kids this should be our goal. As we make parenting decisions (both of content and method) we should ask ourselves (among other things) if this will realistically guide them on the way of Hashem or not. This question can also help us figure out which Torah commands and prohibitions to encourage, or require, them to follow. In general those which are more closely tied to the virtues would be emphasized. (Of course there are other factors in deciding what to emphasize, such as creating a positive feeling towards the mitzvah system or building Jewish identity). It also isn’t enough to decide to separate them from something, how we do it is essential (and unfortunately, a poor attempt can have the opposite effect in the long term).
In the case of the specific Halacha we began with, avoiding forbidden foods can train them in self control. However, that is most effective if they know there is another option, and making the choice to refrain. If it isn’t even thought of as a possibility then the practice in restraint is weaker. For example, shopping in a kosher store is easier since the child won’t desire non-kosher food from the shelf, but it also lacks a learning opportunity, to learn that it is there, and that we make a choice not to eat it.
The Halacha doesn’t obligate us to forbid these things. Separation can take a variety of forms, including rules, advice, discussion of consequences or modeling. Deciding which is appropriate in any specific case, will depend on the child, the parent, the specific character trait and the circumstances.
This is Mishlei’s advice. If we want to raise children who will successfully follow the Derech Hashem, we should begin that practice at a young age, instead of leaving the child with bad habits to deal with when they grow up. By beginning young the way of Hashem is ingrained through repetition, while learning how to make choices under the guidance of a parent who is (hopefully) further along the path (but is also still learning).
 The word “Kedusha” is difficult to translate. The problem with “holy” is that it is a vague term which also needs explanation. Kedusha in general has the sense of being separate and higher, but that doesn’t highlight the specific meaning of God’s Kedusha. The Rambam understands Kedusha as a term which refers to the unifying principle of the way of Hashem, i.e. the middle path.