view of unformatted list invalidating cache issues
The cache tag node_list only works for database changes in the node table, but this is not happening when the user selects a filter value.

This is from the point of the View a cache context. So if you don't find a way to configure the View to handle this correctly, you could assign a custom cache context for the filter value.

The whole picture, which the View can't know because you provide only the filter value to it, is a mix of tag and context. You would need a cache tag for the private tempstore and a context for the current user to get the caching right:

function modulename_views_pre_view($view, $display_id, array &amp;$args) {
  ...
  $uid = \Drupal::currentUser()-&gt;id();
  $view-&gt;element['#cache']['tags'][] = 'users_in_class.' . $uid;
  $view-&gt;element['#cache']['contexts'][] = 'user';
}


and then invalidate the tag when changing the private tempstore of a user $uid:

Cache::invalidateTags(['users_in_class.' . $uid']);