But often times my assumptions about how the code should work evolve over time. After I reflect those changes in the code, the whole system suddenly loses its quality.
Just looking at this old question, I think this idea that a design loses quality when adapted over time in a partial but non-local way, is an outcome familiar to many other professional fields which incorporate either significant amounts of complicated design work and/or complicated building/manufacturing procedures (that require practical experience, and often many rehearsals of doing tasks in a fixed sequencing, for a worker to perform correctly).
In software, the loss of design quality ultimately arises because of a desire to salvage something of what exists, or to keep the software in full operation at all times, which leads to obvious seams or compromises in the design integrity of what is installed new.
Often, there are also signs of transitional arrangements that got things from the old way to the new, or remnants of the existing design (like naming schemes in source code) that were adjudged too troublesome/costly to improve at the same time.
The alternative to accepting partial refits of the design that lead to a loss of quality, is either to review the refitted design in its entirety, or to rewrite everything from scratch.
However, the initial development was often a serious intellectual effort, perhaps taking many years of working time to process all the details. Both a global review of the refitted design, or a total reconception and rewrite, must also be on a similar scale.
The need to cover such a large amount of ground at once means developers risk becoming cognitively exhausted, when the original development was more likely delivered in stages rather than as one big heave, or otherwise punctuated for various reasons.
To avoid exhaustion in a review process, developers may also be tempted to rush through without the serious detailed engagement which the design received the first time around, so that an inferior design is still the outcome anyway.
The amount of return on this review effort, either as perceived internally by the developer, or as perceived by the employer, is also tiny compared to when the original design was being conceived. The prospective benefit of all this effort is not a new design. It is not even the achievement of a working refit. It is merely the restoration of overall design quality that would otherwise be slightly impaired by the refit.
Surprisingly it can also often be very much more complicated and demanding to review an existing design, than to proceed from first principles on a completely clean slate. This is because, with a review, almost all work ends up being a comparative evaluation of an existing facet of the design versus one or more newly proposed approaches, and these decisions cause a significant mental workload.
Whereas when proceeding from a clean slate, the only question is whether the proposed approach seems to solve the problem or not - not whether it solves it better than what exists.
Also, fresh designs are often progressively refined over time in how they solve problems, so that not every design decision is made on the spot up front, whereas when reviewing parts of an existing design and an alternative proposal, the developer is having to conceive not just the general nature of the alternative but also try and imagine and apply immediately all the possible refinements, and then finally decide whether it's better than the existing solution or not.
For these reasons, when dealing with complicated legacy designs, they are at first refitted conservatively in ways that may cause unavoidable loss of quality, and then if a loss of quality accumulates too far, they are simply replaced outright by new designs which seek to proceed afresh from first principles.
Whilst not every change to an existing design may cause a loss of quality, it is not possible for every change to avoid a loss of quality, or for every impending loss of quality to be avoided with a reasonable amount of effort, and that's why loss of quality inexorably creeps in until the design is replaced outright.