Tech debt is entirely about learning. You start by writing the best code you possibly can. Then you learn something that tells you that the code has issues (so fix them). Tech debt is inevitable if you're learning. I, at least, am always learning, so there's always tech debt.