That's why it's important to start with some testcases of required behavior, and then refactor only code that is supported by tests. Because sometimes the fence is there for a reason, but often it's not.
As an programmer I always try to capture these reasons in my commit messages, after a decade of doing this I’ve gotten a lot of thank you notes years after leaving a project, and I’ve even reminded myself details about my own thought process that I had otherwise would have long forgotten.
One thing I’ve learned by having long tenures is that context change over years is much more likely the reason for nonsensical code than developer stupidity.
The difficulty is making sure that you have all the requirements and aren't missing any, and once a system gets big enough, that gets really difficult.
> The more modern type of reformer goes gaily up to it and says, "I don't see the use of this; let us clear it away." To which the more intelligent type of reformer will do well to answer: "If you don't see the use of it, I certainly won't let you clear it away. Go away and think. Then, when you can come back and tell me that you do see the use of it, I may allow you to destroy it."
The point is that there might be a reason, and before careful consideration we won't understand what that might be.
If you're very confident that your test suite covers all use cases, then you can just change it and see what breaks.
Knowing what I know about how some organizations work, I don't think this is necessarily a safe assumption.