But then when they were trying to find Bartlett, they just waltz right in to his sexual fantasy. You'd figure they'd have a "your commanding officer is looking for you, knows you're in here, and this is the knocking, so save and exit the program and pull your pants up if you need to."
Though with holodeck technology, it's a wonder they even bother exploring the universe. That might be the most unrealistic part of Star Trek.
Maybe the author is British and really just wants all replicators to only serve O'Brian diseased potatoes but understands that that would be too on the nose.