views_get_current_view returns null
views_get_current_view() seems to be from the early days of procedural code and I don't know how this can be used in connection with form building in D8.

You can get the current view from the current route, if this is what you are looking for:

use Drupal\views\Entity\View;

  $view_id = \Drupal::routeMatch()-&gt;getParameter('view_id');
  if ($view_id) {
    $view = View::load($view_id);
  }