If you have a pet dog or cat that has a nasty cut, you'll find that it will lick its wounds. The wound can actually take longer to heal, or can get infected, as a result. Of course, your pet doesn't know that, its just doing what its instincts tell it to. To solve the problem, you give them an Elizabethan collar. It lets them continue eating and drinking, but doesn't let them cause any more damage to the wound. In the meantime, you can apply some disinfectant and clean the wound right up so there's no more problem.
Sometimes you come across software teams in the same situation. They've got a wound in their software, and they're instinctively licking away at it in the hope that it will get better. It might change from a nasty cut into a puss-filled scab, but its often not improving.
You can solve the problem in exactly the same way. Give the team an Elizabethan collar that lets them keep going on with their daily lives, but keeps them away from that wound. You might need a layer of abstraction, a checkstyle rule, or a continuous build. Preferably something automated that keeps them from twisting around and gnawing on that nasty gash. In the meantime, step in and apply whatever disinfectant is required to clean up the problem. A spoonful of refactoring will often do the trick, but sometimes a full transplant is required.
Once the job is done, you've got a choice. Sometimes you will choose to keep the collar because the team have become accustomed to living with it, and it might come in handy one day. You might also be able to remove the collar to let the team see your efforts at first aid. In many cases, that patch of skin will now be boring and uninteresting, so they won't bother with it anymore. If you're lucky however, they might be interested in the process you went through, and will resist the urge to gnaw next time they get cut, coming to ask for help instead.