Condition in variation product template is not triggered correctly (ajax caching ?)
If you have other input data(url, query params, timestamp, cookie, etc) than $variables in your HOOK_preprocess you have to update your cache rules otherwise first time you get trough that hook will get cached for the rest of iterations of same $variables input.
In your case I suggest using cache context or cache tags where they change based on POST and GET variables.
https://www.drupal.org/docs/8/api/render-api/cacheability-of-render-arrays