Regardless of how much PMs might want things or fiddle with the schedule, as professionals it's our job- not theirs- to say when things can't be done, shouldn't be attempted, or might cost more than they're worth.
That gets back to company culture (which others have identified higher up). Not every organisation responds appropriately when developers push back (either due to imposed deadlines or office politics).
In my experience, organizations generally do the right thing if all the developers push back. The problem is that you can always find developers that will push a hack or deploy an overwrought solution for a simple problem.
Maybe you're lucky or maybe I'm benighted, but it's rare that an organization consciously decides that this is the quarter to finish off the Java 5 migrations, even if that means delaying the Jabberwocky Project and even if there's a non-zero chance of customer impact.
Partly because it's a really hard problem to attach an accurate and objective number to the value of something like that.
> ...technical debt and the benefits and costs associated with varied approaches...
That's not entirely accurate. Engineers are experts at technical benefits of different approaches. And they should be experts on the entire cost of the systems they are responsible for. But they're not necessarily experts on the benefits. They aren't necessarily qualified to anticipate what different features and different release schedules will do to the revenue for the product. In B2C companies with millions of users, you can run statistics and A/B testing to make this stuff more objective, but a lot of companies live and die by big sales to a smaller number of customers. So determining the benefits of shipping a month early depends a lot on knowing particular people well enough to guess how they'll react to good or bad news.
One solution I thought of was to enact a 20% code debt policy, similar to google's 20% time but for code debt. Hey developer, is there something causing you pain? Fix it!
There are two outcomes (1) they trust you, and grudgingly accept your estimates. You address what debt you can and ensure padding doesn't increase the next time thus trust is maintained (2) they force a timeline on you, in which case when it's late or broken in production you can at least say you needed more time.
There is a third more egregious possibility, that they get an alternative estimate from elsewhere or one of your colleagues and in my experience this is the principle weakness to standing your ground "we'll take our business elsewhere" and I am truly sorry for your trouble if that is the case. Hopefully you have secure employment and the whole mess then just becomes the problem of the person that undercut you.
Of course, in all these situations you have to make a call based on your personal/organisational circumstances but I just want to say that ultimately being upfront, diligent and continuously demonstrating trustworthiness may not always pay off in each particular instance, but over the longer term as reputation accrues they do.
That's sort of how I do it. The key is to never tell management explicitly. It's just normal part of the job.
The only problem is that this setup is subject to the tragedy of the commons. If it takes 25% more work to make a change cleanly, the developers throwing hacks around look 20% more productive if we ignore technical debt. And, worse, they're often the only people in the world that understand the hacks, so they get to be the hero-experts that come in and save the day when everyone else is trying to figure out what the hell is going on.
So even if we'll do our best to bake the cost of cleanup into our day-to-day tasks, that only works as long as a critical mass of the developers in the organization do the same thing. Otherwise, you'll have a full time job plus some just cleaning up messes.
This works only if you own your part of the code for a some time so your investment can pay off.
The same _can be_ true with code. There can be a better way to do something but if you cannot afford the time to develop and iterate this idea then it can be advantageous to develop the simplest solution that meets your needs today and make progress.
Can you give an example?
Something unexpected pops up like a family member dies and you need to arrange a funeral, but don't have the cash on hand because some other emergency last month used up your liquid savings. You know that you can pay it off over the long run, but don't have any other way to deal with it right now. So you go into a small amount of debt that you can likely pay off without paying too much over the original cost.
There are a million ways that they can be good. There are probably more ways they can be bad, but this question is very simplistic.
When that's the level of awareness the average development team is dealing with, there's limited practical purpose in exploring the nuances of healthy debt management. It's more useful to talk about technical debt like nutritionists talk about empty calories and transfats.