truth be told, sometimes i do mess up the flavor balance, but, whenever i do, i try to identify where i went wrong. i'll ask myself questions like "did i overdo something? " or "am i missing something?" to try to build up my Cooking Brain.
i have learned how an ingredient might contribute to a dish's overall taste by reading nik sharma's flavor equation and which ingredients tend to pair well together by skimming niki segnit's flavour thesaurus. i also pick up on what works and what doesn't by trying new food at restaurants and keeping an eye on what chefs and food bloggers are making.
through these experiences and the experience of cooking myself, i am building up a personal understanding of what i might / should do in a given situation. a lot of my substitutions come from hunches that a different ingredient is similar enough to the one called for by a recipe, and my additions tend to come from feelings that a new ingredient could contribute something particular (e.g., more crunch, more acidity) to whatever i'm making.
hope that makes sense. :)