Fix isValidTreatmentVars should evaluate if existence first

Reviewer: Tiff Go
Issue: GCP-9743