Music has been around for a long time, but how about music theory? What was the first instance of a publication on music theory?
Short Answer: The earliest known publication on western music theory is Aristoxenus's Rhythmic Elements of the 4th century BCE; it is fragmentary, and it is the only surviving text from before the 11th century CE (!). His Harmonic Elements of roughly the same time has been reconstructed from later writers.
Long Answer: The music theory community generally agrees that Pythagoras was the first western music theorist identified in the literature. With that said, nothing that Pythagoras ever personally wrote regarding music theory has survived; we only know of his writings from later writers. The earliest of these writers is Aristoxenus, living in the 4th century BC (Pythagoras died around 500 BC). With that said, although Aristoxenus transmits a lot of Pythagoras's concepts, the two are considered to be leaders of their own respective Greek traditions: the Pythagoreans, who emphasized the role of numbers in music and the cosmos, and thus their teachings were not very practical for the performing musician; and the Aristoxenians, who emphasized tools for the practical (that is, performing/composing) musician. (Warning: this is a very broad generalization between the two!)
Pythagoras's emphasis on numbers would continue for centuries; the famous (if apocryphal) story of him passing by the blacksmith and learning the ratios for intervals was recorded by Nicomachus in his Manual of Harmonics in the 2nd century AD. These Pythagorean ratios were largely unchallenged until about the 15th century with Ramis de Pareia, but even then the influence of Pythagoras is sensed in Zarlino (1558) all the way up to the present day in discussions of tuning systems.
(Source: The Cambridge History of Western Music Theory, ed. Thomas Christensen. See especially the chapter "Greek music theory" by Thomas J. Mathiesen.)
Not sure if you are thinking about western music theory. But people all over the world have had 'music theory' before Pythagoras.
For example this link goes into history of Indian music theory http://www.nadsadhna.com/Pages/IndianMusic/OriginIndianMusic.asp