Being alerted that an enemy has seen you and is coming after you is a feedback mechanic to increase gameplay satisfaction. If you thought you were still sneaking and a raider ran up and shot you in the back, a lot of players would think (incorrectly) that Stealth was "broken". A basic rule of good game design is that a player should always be aware of the current game state. Feedback like the music changing, an enemy yelling "I think I saw something!", etc. are examples of this.