To me, music theory is the study of how music behaves. Every note, rest or chord has an effect: a consequence. What that effect is largely depends on the musical context.
When listening to a piece we can hear how the notes and chords link together within the context of the key, time signature and tempo, predominant rhythms, phrasing etc. This is how we perceive music.
If we can understand how different combinations of notes produce these various effects we develop an insight into the composer’s mind and a deeper appreciation of what the composer intended. For creative players and composers, music theory provides the tools to determine which combinations of notes will provide the effect they want to portray.