refactor: simplify and micro-optimize group override handling

Description

Simplify and micro-optimize group override handling

Delay getting flag and environment values which don't affect the outcome until actually needed, exit early.

Found while working on !4324 (comment 4203654989)

How has this been tested?

Unit tests only (unmodified).

Screenshots (if appropriate):

N/A

Merge request reports

Loading
Loading