It’s called “The Doorway Effect” and it’s something that can effect anyone. The action of passing through a door can affect short term memory causing you to forget what you were doing a moment before. It’s possible that it’s attributed to self preservation in causing you to assess your surroundings on entering a new room.
Not to say it’s not a problem for ADHD, but it’s a more common issue than you’d think.