When does caching kick in? I'm trying to limit certain views on certain pages, like preventing certain articles from appearing on /node, and I'm using hook_views_query_alter() with \Drupal::service('path.current')-&gt;getPath() to figure out when to do that.

Is this going to work, or will view cache kick in before this hook can be used? How can I write my own rules into the view so that it will only cache after I've been able to add in my excludes?
It might be a better idea to set a contextual filter on the path. You can still do some tweaking in hook_views_query_alter(), if needed (you can do a lot of things with contextual filters in the ui), but at least views knows by doing that which cache contexts it has to set.