Some questions are marked as duplicates years after they were initially asked. It seems that if it took that long to find a duplicate, then the original question (the one being duplicated) was poorly worded, hard to find, or otherwise, not quite the same question. As such, would it not make sense to have a time limit on when a question can be marked as a duplicate (or really closed for any reason)?
Some Stack Exchange sites have an incredibly high number of questions and answers. And some of the community have preferred tags they only look at.
A duplicate being hard to find does not give you any message as to its 'appropriateness' of being a duplicate. A duplicate does not stop being such due to some expiry date.
Let's not bring in time limits - in fact we should encourage people to look for dupes in older questions as they may have been long hidden under the weight of more recent ones.
As such, would it not make sense to have a time limit on when a question can be marked as a duplicate...
No, this doesn't make sense. Duplicates are nothing more than pointers to everyone (not just the OP) that the post might have an answer in another location.
Generally speaking, when it happens early, it is usually a pointer to both the OP and future readers. The OP can then assess the post and decide if it isn't a duplicate, and whether he/she needs to clarify points in their question.
When it happens later in the life of the post, the message is for future viewers that the might find (another) answer in another spot. It saves them time from having to look and search through dozens of posts to find something that could answer their question.
As has been mentioned in other answers, closing as a duplicate is not a punishment. It is a helpful message to send people another post with more (and hopefully better) answers. And it isn't always the older post. Sometimes a new duplicate is asked, but the quality of the question is just much better than the older post is closed as a duplicate of that one.
...(or really closed for any reason)
This added note is a stretch. Just because a post is old doesn't mean it is on-topic and a valid question.
- Posts get missed frequently, and given the volume of questions Stack Overflow gets, it is possible an off-topic question slips through the cracks and doesn't get seen by enough people with close privileges to deal with appropriately.
- The scope of the site is always in flux. Just because it is a good on-topic question now doesn't mean it will be one tomorrow, or 3 years from now. There are hundreds (or probably more like thousands) of questions that were asked 3-4 years ago that were perfectly on-topic then but are off-topic now.
As such, it is necessary to close questions in both of these cases when they are found so they don't serve as a signpost that this type of question is acceptable.
Was this post inspired by a 'years after' closure of one of your questions? As Bart mentioned in the comments it's not a punishment.
Duplicates often get considerably less attention than the main, so closing as a dupe shows a nice helpful link to any future visitors about the best place to find a solution.
Though I'm not sure that a time limit is optimal, I think in a technology exchange, a good answer five years ago might be a bad answer today.