It stands to reason that only people who have been authorized beforehand by Picard (or Yar, in his absence) should be permitted on the bridge. All Picard has to do is tell Yar "no kids allowed", and instruct the ship's computer not to open the bridge doors if an unauthorized person is present. If he doesn't do that and a child wanders onto the bridge, don't blame the child.