If you view music as a language, then theory is the study of its grammar. Just as you can learn a language and never study its grammar, I suppose you could learn music without knowing any theory, but in practice I find most musicians have intuited theory whether they’ve formally studied it or not. [Personal opinion warning!] I think it’s essential for guitarists, given our strange function within the rhythm section as a source of both harmony and drive.
Theory comes in different flavours and shapes - music theory based on classical models is centered around the music of the 18th century, and is both descriptive and prescriptive. Throughout the 19th century composers either expanded the potential of the language or broke the rules, depending on how strongly you felt about the prescriptive nature of theory. By the twentieth century, composers had the freedom to invent their own compositional systems or avoid compositional systems, and theory had to evolve to keep up with them.
Classical theory is centered around the relationships between chords - the chords themselves (Major, minor, diminished, dominant 7th) are determined by the key, and those chords change as the key changes. (The last time that phrase came up, we were in A Major, but now that we’ve gone to F Major, a chord based on the note ‘a’ will be minor…)
Rock theory, on the other hand, is much more concerned with the types of chords and less with a solidified definition of their function within the key. That’s why “Wild Horses” has both a D Major chord and an F Major chord in the chorus - not that a Mozart sonata wouldn’t have had both chords in it, but not on either side of a G Major chord. Rock theory can centre around rather minute definitions (see an earlier thread from this summer about Sus2 chords, and how they are different from add 9, 9, Maj 9, min 9, +9 and #9 chords).
Jazz theory shares both obsessions, esp. as the guitarist, bassist and pianist get to spice up the progression by altering or substituting chords, and it only works if they work together.
Among the useful things about understanding theory for the guitarist - there is no such thing as the unknown chord. Every chord has two parts - the note upon which it is based, and the quality of the chord. A Major and B Major are the same quality of chord, based on different notes. A Major and A diminished are based on the same note, but are totally different chords. G6 and emin7 have exactly the same notes, but function differently within the piece, and the difference is in what the bass notes are, and what’s doubled. You can be playing all the G6 you want, but if the bass player is laying down an E and a B, it’s going to sound as an emin7. Anyway, the point of this little rant is that even if you’ve never played Ab7 to Db before, theory can help you figure it out. An unfamiliar quality of chord is trickier, but in general, rock musicians write the shorthand in a way that’s easier to parse on the fly (Bb/C rather than C11, f’rinstance.)
So, to finally address your original post - no, there’s no optimum age for learning theory. The hardest thing about it is that there’s more than one name for the same thing, and simultaneously the same word can refer to more than one thing. If musicians aren’t crazy when they start out, then music drives them crazy.
And a huge second to whoever said ask some questions here if anything confuses you - there are some of us who love discussing theory, and we’ve all been through at least one day when we wanted to scream “Bugger all this!!!” and drop our harmony textbooks down the bog.