So games don’t tend to work the way real life does.
Unless you want them to, I suppose...
Sure, but who would make someone roll for such a mundane thing? We’re taking about D&D right? Aren’t the PCs in your game generally doing things that might actually cause harm to themselves or others? Aren’t they doing things with actual stakes?
Trying to pick a lock has stakes, namely whether you can get beyond it or not. There may or may not be any threat of harm involved, but there's still no guarantee they'll get the lock open. They might have to resort to boots or crowbars or a different point of entry.
Are your games filled with pickle jars and other consequence free crap?
No, but life is, and a completely mundane example seems to have got my point across.
Please. Do your players shy away from all danger because sometimes bad things happen?
They do what they can to remove, avoid, or mitigate the dangers before those bad things have a chance to happen. If they can get it down to failure meaning "nothing happens" that's a good result for them; then they just need to reduce the chance of failure in order to make it more likely they'll get what they want.
I know were I a player in a game where I knew that every time I failed at some task that the fiction suggested carried little to no chance of dangerous consequences and yet something was still going to hose me anyway, I'd do whatever I could to find can't-fail means of achieving the same ends.
Which seems to go against the idea of "accepting the risks" that some of these games seem to expect, but sorry - no matter what the game, I play in survival mode. Self-preservation is job one. Preservation of my companions is (usually) job two. Mission accomplishment is job three or four or five depending whether I care about it in-character. And when there's an unavoidable risk needs taking I'm happy to take it, but I'm going to do everything I can to better my odds of survival before diving in.
Yes, closed it remains. But there could very likely be other consequences. If I was trying to open the jar for my pregnant wife who’s having a craving, then a trip to the grocery store may be in my future.
An indirect potential downstream consequence, beyond the scope of immediate task resolution.
The surrounding context is why you’re trying to do the thing. To say it is irrelevant seems delusional.
When you're resolving a task, what matters is the resolution itself. Not the whys and wherefores, not the history, not the future, but right now. History's done, and the future is as yet undetermined; and while the future will very likely be affected by how your task goes, it's rarely if ever locked in beyond your next opportunity to do or try something else.
I can put the lock-picking in historical and temporal context when looking back on it later, after the whole break-in situation is finished, aborted, or busted.