Moving away from line of sight (I don't think stealth is even required), easily done using verticality, tend to break the AI and cause easily exploitable immersion breaking scenarios. Obviously this can't be allowed to stand and will be improved down the line.
That said, I hope for *MORE* legitimate tools to "break the AI", like allowing the "Minor Illusion" cantrip be used to hide/conceal players. In your scenario where the guard spotted you, he/she should either; a) call for reinforcements, and/or b) inspect personally, but still be possibly fooled by you casting "Minor Illusion" to appear hidden by a bush, barrel or even wall (tabletop version allows for this versatility).
I like the reinforcement suggestion, but something like that would likely require an overhaul of the xp system to avoid "milking xp" on purpose. Somewhat reduced xp for killing enemies and compensate by introducing a xp bonus for clearing/solving areas for instance (this would incentivize more stealthy/diplomatic playstyles as an added benefit).
The reinforcement is essentially what we have in XCOM. And I think they could do it in some areas like the goblin camp, the blighted village and the swamp.