Coming from a background of not much computer science and having dropped out of college, I found learning theory to be too lengthy and dull for my novice mindset at the time I started programming (in, quite fittingly, HTML+CSS+JS+PHP on LAMP). I was in the same shoes as your friend, as whenever I would see an open-source project or library, I would be quick to modify it to suit my needs, but would end up with massive if clauses and without much modularization. Of course, after about a year or so of doing this same bad practice, I came to ask "Truly there must be a better way than this, right?" It was at that point, after already becoming completely addicted to programming (yes, in the ugly, somehow-working kind of way) that I gained enough patience and interest to learn more theoretical concepts about computer science and its applications to programming (lambda calculus and functional programming in particular). I agree with you, being that this ultimately ended up helping me greatly, but I disagree that CS theory should be the very first thing a novice programmer approaches.