You had the best of intentions, no doubt about it.
However, there is a fine line.
If the bug fix in place takes 10 minutes, and a redesign of that section takes 2 hours, with the possibility of introducing new bugs, causing a need to re-learn the way a module works, could definetly be considered well beyond the bounds of what you were asked to do.
Was it your decision to spend that time, rather work on some other important bug or feature the buisness wanted done?
Maybe the technical debt issue is not relevant at all because they are scrapping the system or rewriting it in 6 months.
Anyone coming in (contract or permie) rewriting stuff when not asked to do so will always be met by hostility, I've seen it happen lots of times.
As it happens these types of systems are one of he main reasons I started contracting so I wouldn't get stuck for years maintaining rubbish. I like to write my own rubbish from scratch!
