of course ymmv. had only 5/6 such bosses. the only one that wasnt like that, was not in software but a little shop selling custom built computers and i was a teenager back then, so that might have made it a little easier on me too
But some things help - when giving estimates or timelines, I go through my usual charade of "they are guestimates, usually you should double or triple them, the further out they go the less likely they are accurate etc".
Also, I promise I will monitor progress, keep them up to date, and let them know as soon as possible when plans deviate. I also discuss backup plans early (cutting features or pushing back, starting with pilots and tests, etc..)
It has worked pretty well for me so far. Not to say it's _just_ about how you handle the situation, you can have a shitty manager, that part is out of your control unfortunately.. :)
It's a really tough tendency to fight. One thing I think is helpful is to acknowledge failure as early as possible. If meeting the deadline would require me to work faster than normal or make some heroic last-minute effort, I've already failed, even if that deadline is still a long way out. Admitting that to myself and others now, so that expectations about the future can be adjusted, is a much smaller blow than admitting it weeks or months down the line. And it means I only have to feel a little flaky and underperformant, rather than super flaky and underperformant and also dishonest.
[1] https://80000hours.org/podcast/episodes/depression-anxiety-i...