A better analogy would be someone entering your house if the door is left open, and then them shouting to see if someone is home or if they left for work - in view of closing the door for them.
And then someone called the police when they found someone random was in their house without authorization. And the intruder said "I was only there to shut the door for them."
Yes, your analogy does stand. And it stands to reason that the intruder should be punished, and/or sued, for trespass. It is not a legitimate reason to be in someone else's house.
Going around trying to open everyone's doors is a similar analogy to some other security research. And while its not as clear-cut, in fact arguably not a commonly cognizable crime, it certainly is suspicious and its reasonable for law enforcement to investigate such activity.
So if I suspect that someone else will steal from a house if the door is left open, (And I have strong evidence for this)
And I see that the door is significantly ajar (one can see valuables through the open door)
And the house appears to be empty,
And the doorway is flush against the sidewalk, where I am walking by on my way somewhere else (the door opens inwards and is not in my way)
If I knock on the door (holding it so as to not make it swing inwards further and hit the wall) and ask if anyone is there,
And recieving no responce, close the door,
I should be punished?!?
If I see someone injured and unconcious on a sidewalk, should I just walk around them in order to avoid infringing on their personal space?
What if I have relevant medical experience?
Am I to let them lie there?
If someone (a stranger) is unconscious from drinking alcohol to excess, and is lying on their back, am I to refrain from turning them on their side, and instead allow them to choke on their own vomit and die, so to avoid running afoul of laws intended to protect against pickpockets?
If someone has a problem and is in danger of significant loss, but is unaware of it, and I am unable to inform them of it, but I am able to easily lessen the danger, at no cost to them or any other person, through an interaction that bears some similarity with some action that would be reasonable to forbid due to causing harm,
Should I not help that person simply due to that similarity?
Edit:
It's possible that I misunderstood what was said somewhat. I'm not sure.