I'd like to expand a bit on guidot's point. That answer points out that publication was not historically a major goal for many major composers, particularly before ca. 1800.
However, if we look to this part of the question:
after their works are already openly performed in public concert halls
or theaters?
As long as we allow typical performance venues for the day (which typically weren't "concert halls" before ca. 1800 and only "theaters" for certain genres like opera), then it's fair to say that revision was frequently the norm for "classical composers" in certain contexts, particularly for large-scale ensembles where later performance tended to require adjustment to what instrumental forces were available, abilities of specific performers, etc.
The reality was that before ca. 1800 most music was rather ephemeral. Like pop music of today, it went with fashion, and it was quite unlikely that anyone would perform music that was more than a decade or two old in many contexts. There were exceptions, of course, but the more "public" the type of performance, the more music tended to change with fashion. When music in this context was "revived," it was often significantly revised as well.
For a stereotypical example, one might look at Handel's Messiah, which beat the odds and continued to be performed again and again for many years. At least nine different versions exist and over 40 different versions of the solo numbers. There is really no "definitive" version of Messiah, as Handel originally wrote the piece for a very small performing ensemble in provincial Dublin, and later expanded and changed the piece for larger orchestras, the type of singers/soloists he had available (and their abilities), etc.
This type of revision was quite common and popular for public works like operas (again, which tended to follow fashion trends and often tended to have parts of the works composed specifically to suit the talents of specific singers). In many cases, composers also reused their music by significantly recomposing it, reorchestrating it for different ensembles, etc. (Handel did this himself with Messiah, as several choruses are actually based on earlier Italian arias from secular cantatas.) And they frequently did this with the works of other composers as well.
Basically, before about 1800, it was common for music to be composed for specific occasions and modified if necessary if it was ever performed again. (Note that revivals of older works by other composers were frequently often reorchestrated by the conductors -- themselves often composers -- again, to suit the tastes of the day and the available performing ensemble. Until the mid-20th century, it was also somewhat common for solo performers themselves to take more liberties in how they played classical works, adapting or elaborating passages when they saw fit.)
I sense in OP's comments that this sort of thing isn't what the question is after. OP seems interested in some idea of new editions and revisions as "perfecting" a work.
The problem is that's a somewhat anachronistic attitude toward what music was before ca. 1800. Around that time, as Lydia Goehr has written about, there was the emergence of what she calls the "work concept" in European music. That is, before around 1800, composers tended to be composing ephemeral music tailored to whatever was needed for the time and fashion. But after around 1800 (and particularly with a bunch of high-minded philosophical speculation about the status of the works of Beethoven), composers gradually came to view their compositions as permanent "works" of art, which should have a more perennial status.
Thus, in the 19th century, you also see the emergence of the concept of an "Urtext," and you have institutes founded that dug up old works by J.S. Bach (for example) and attempted to consolidate all the disparate sources with their variants and come up with a single "pure text" that was meant to be the "true version" of the work.
Such a concept would have been completely alien to the way music was composed and understood at the time of Bach, but it became the norm of the way music was composed in "classical" circles by about 1850 for many composers.
It was only in this new era of the 1800s that publication became a way of establishing a more permanent "text" for a composition, too. And we can see how fluid this notion was as the work concept was emerging, as the care with which composers oversaw the publication of their works (and the level of oversight allowed by various publishers) varied quite a bit. One well-known case is in the works of Chopin, where different variant editions tended to appear almost simultaneously for many works in France, England, and Germany (or whatever we want to call the German-speaking lands at the time). The reason for the variants had to do with the way proofreading processes worked with various publishing houses as well as how editors and "house styles" may have interacted with how the music was engraved.
In general, many editors of music in the 1800s (and into the early 1900s) took more liberties than today with the state of the music for publication. (Some editors, particularly when they were dealing with older music where a composer was either dead or unlikely to care about proofreading engravings anymore, tended to just throw in all sorts of added markings for interpretation that may have nothing to do with what the composer wrote.) That's the reason many "Urtext" editions for some composers have to go back to manuscripts to try to sort out what the composer actually might have meant, rather than relying on any specific published version.
We also see the gradual adoption of more and more score markings from the mid-1700s and throughout the 1800s in music publication. Early published music from the 1700s and before tended to have very little interpretation markings (from tempos to dynamics to articulations), but those became more and more common and specific throughout the 1800s. Some composers cared about these things more than others, and some editors/publishing houses were more likely to introduce their own "clarifications" than others. To go back to Chopin, he was likely to put some of his own fingerings in published works, but editors often added their own (or modified them) too. How much of this is important in the status of the "musical work"? I suppose it depends on how much effect you think specific fingering can have on interpretation and sound of the piece. But in many cases, one sees variants in dynamics, articulations, etc., as well as placement of these things in scores.
In any case, by around 1900, the idea of the "musical work" was quite well-established, so much so that many composers began to fret more over the form of their works as they would eventually go down in history. Thus, you begin to see deliberate revision from some composers after publication, as well as more insistence on exactitude in editing and publication (rather than the loose standards that were pretty common in the 1800s and before). I'm generalizing here, as there were certainly composers in the 1800s who made significant revisions to their already published works (not just corrections), and some composers were more exacting in their proofreading of works for publication than others (and/or were able to exert more influence due to their fame on making sure things were "right"). But there's a general trend over the course of the 1800s from a notion of published music as more of an ephemeral object to a sort of "true record" of a composer's permanent "work."
In general, the answer is that for most of the history of classical music, there's a lot that was in flux about editions of music used for performance and published versions. It's only since maybe the mid-20th century and the emphasis on "Urtext" editions by performers that we now have a common expectation that a published version of a work should generally be the definitive version of the composer's intent, at least as much as was notated. Without the annoyance and complexities of hand-engraving for music publication today, it's also much easier to make corrections when requested or needed.