Home ec is more of experimentation and learning while coding is more of logic.
Adding a bit of salt and sugar will affect cookies by a bit. That's not the case for coding.
Speaking as someone who learnt to program at quite a young age but is also a fairly good cook I think you have a pretty dim view of cooking based on your experience of home ec.
Personally I compare cooking far more to what I learnt from the years of experimental physics and chemistry. Many recipes are actually extremely complex and even a very small change can make things utterly fail in the same way as your c example.
Try making bread sometime and kill up the yeast by adding boiling water instead of just warm. Or making yorkshire puddings but open the oven for a few seconds about 5 minutes after you put them in. There are a great many examples of things you do horrendously wrong while cooking. By learning the logic behind why these examples cause what you are cooking to fail you learn the things you can experiment with, and the things you absolutely cannot.
Programming is no different to anything else, you can learn to do it but will make mistakes along the way. You learn from them, and then don't do them again. I think that if we could probably start teaching the basis of programming at the same we introduced things like home economics or design and technology so certainly from about 11 or 12 and up.
I intend to try and teach my daughter long before that though if she shows any interest in what her dad does. In my case I learnt because a friend of my mothers wrote his own computer games and I enjoyed playing them, I hope I can try the same trick with her.