"How long will this take" is usually three different questions pretending to be one, and that's why estimates are consistently wrong
Sat in enough estimation meetings to notice a pattern that has nothing to do with optimism or bad math. The question "how long will this take" gets asked as if it's one thing, and answered as if it's one number, when it's actually collapsing at least three separate questions that have different answers and different levels of certainty.
How long will the code itself take to write, assuming nothing surprising happens. How long will it take to actually figure out the right approach, which is a research problem, not a coding problem, and has no relationship to typing speed. And how long will it take to deal with whatever wasn't visible until the work started, the dependency nobody flagged, the edge case that only shows up once you're inside the problem.
Most estimates answer the first question and quietly present it as an answer to all three. That's not dishonesty, it's usually the only one that feels answerable at the time the question gets asked, since the second and third are genuinely unknown until you're partway into the work. But presenting an answer to "how long to type this" as an answer to "how long until this ships" is where almost every blown estimate actually comes from, not from the coding part running long, from the other two questions never having been asked separately in the first place.
What's helped, imperfectly: giving each of the three a rough separate number instead of one blended figure, even if two of them are honestly "I don't know, could be a day, could be a week." Doesn't make the uncertainty go away, but it stops the uncertainty from getting silently absorbed into a single confident-sounding number that nobody actually believes once things start slipping.
Curious how other teams handle this, whether anyone's found a format for surfacing "I actually don't know" as its own category instead of it getting rounded into the estimate anyway because a stakeholder wanted one number.