So my estimates are pretty much always "if it's well-built, documented, and fits what I expect, a week or less. If not, up to 2 months or more, but I should know more in 2 weeks". Getting a more accurate estimate quite often means spending as much or more time investigating than it would take in the optimistic case, so usually the answer becomes "give it a shot and we'll decide again later". Sometimes I have good news, sometimes not.
---
We sit on top of millions of lines of code, changing faster than we can read much less understand. You cannot know it all, nor is it worthwhile to try in the vast majority of cases. Poking into new territory is common, and the ability to do so effectively is a super important skill.
At work, someone used a 3rd party library to send stats to a server in json format and “standardized” on it. 100s of developers had to now learn this new library and it’s APIs and one bug caused everyone a bit of hassle. It probably made the original dev’s job just a little easy but made it a bit hard for everyone else. These things do happen. The point is to learn from this and make better decisions over time, not give up and say we can’t get better. Trying to provide an estimate forces you to think more carefully and become better over time.
> "not give up and say we can’t get better"
Not sure why you feel the need to state this straw man? That is not my opinion, nor do I think it is the GP's.
IMO this attitude is pretty prevalent, and extremely harmful to software engineers. Software frameworks, methodologies, and techniques change very fast [1], and if you think that someone who needs to learn something is unqualified for the job, you are going to have an inherently adversarial relation with the engineers on your team.
Learning is and should be a normal and expected part of the day-to-day job of a lot of software engineers today. I think this contributes a fair bit to the problem of estimation.
[1] In contrast, I haven't seen a ton of novel developments in project management since the early 200s, we are still beating the drum of "Do Agile Not Waterfall" almost 20 years later