Fix fast setImmediate running before microtasks queued by nextTick
The scheduler only checked `pendingNextTicks` when its own nextTick ran.
A nextTick queued ahead of it has already run by then, so the count can
be 0 while the microtasks it queued are still pending. The next captured
immediate then ran too early, or capture ended and an immediate queued by
those microtasks ran after the next stage.
Snapshot whether nextTicks are pending when the check is queued, and
retry if either the snapshot or the live count is non-zero.
Fixes #102141
<!-- NEXT_JS_LLM -->