Fixes Jenkins-18931

Prevents a build from incorrectly triggering when a upstream build starts building.

This also prevents a race condition in the context where the context will be recorded against one build and trigger matching is performed against a latter build.