This scenario mentioned above is a classic example of what is called as the trap of Eroding Goals in Systems Thinking.
You may imagine the same trap in many other work aspects of Agile teams. For example, deteriorating coding standards, rise in the number of production defects, increasing instances of non-adherence to team working agreements, constantly reducing frequency of deployments, trending down test coverage, weakening Definition of Done, and many more.
So, how do we deal with this trap?
One golden way to deal with this trap is to always keep your performance standards absolute. This means that your standards should not be tweaked under the influence of your past or perceived performance. In the case of Scrum Teams, the absolute performance standard is to meet the Sprint Goal. Not meeting the Sprint Goal in a given Sprint is to be treated as a failure with no tolerance, irrespective of how many times this has happened in the past. Only then, there will be motivation to take corrective actions to prevent future failures.
Similarly, your defined standards around code quality, frequency of deployments, test coverage, etc should be absolute and not lowered down because of past performance. Treat every failure in meeting the standards with all seriousness, instead of adjusting the standards themselves.
Moral of the story:
Be the frog who jumps out, not the frog who gets boiled!