Before I say what I came to I would politely ask you to not use buzz like “tech debt.” Our industry is being poisoned with bad nomenclature. I’ve seen a direct reverse correlation between the use of buzz (stories, refactoring, technical debt) and competence.
Call it “unfinished work.” It may not sound as cooool but it’s more accurate.
Anyway. Bad code bases don’t appear whole, they grow. I spent three years on an ASP.NET project where the code had overflowed its banks. I found a dozen functions doing the same query, some identically and some monstrously inefficiently. You wouldn’t believe it. I wrote one parameterized version and replaced all the other calls.
We had one page, email history, that took an astounding 150 seconds or more to load. People had just piled on new data in the query and tried to get everything they might need in a single call. With a few minutes of reading code and about an hour of work and testing I got the load time down to network latency, half a second.
I’m no Isaac Newton. I just read the code. Most developers don’t.