GMs and players get to determine when an encounter starts. It's entirely possible to Avoid Notice and sneak past a guard (if you beat their Perception DC) without ever dropping into initiative at all. You only go into encounter mode when it's important to know what's happening round to round. Now if you fail the Avoid Notice, then sure, dropped into encounter time.
Similarly, if someone in the party is Searching while moving, the whole half speed/investigating thing indicates that you spot the ambush (or indications that there's an ambush) before you trigger the encounter. Sparkleface, the unfortunately named grizzled dwarven veteran raises a fist, warning the party that something is wrong - the animals are too quiet, a twig broke the wrong way, why does the air smell like kobold, etc. They then huddle together and decide how they want to approach things. Do they spring the trap? Set one of their own? Move around it?
The whole 'stealth for initiative, and do I see individual kobolds' bit triggers only if the encounter actually happens, which is not a foregone conclusion.