project: Only check non-cache vars when setting project vars
The change in !9820 (merged) was meant to only check for non-cache variables when deciding whether to set non-cache project variables for the current call. However, it erroneously checked for any variable, including cache variables. This gives the intended result on the first run, but on subsequent runs a cache variable will exist that did not on the first run, leading to different behavior between the two runs. Fix the logic to only check for a pre-existing non-cache variable, as was originally intended.
Fixes: #26355 (closed)
Author: @craig.scott
Backport: release
Edited by Brad King