How do I add grouping, programmatically?
Finally found a solution. The grouping is not an Eventhandler in Drupal 8 but a Plugin (Style Plugin) specifically. Here is the code

function utility_views_pre_build(ViewExecutable $view) {
  $view-&gt;style_plugin-&gt;options['grouping'][0] = array('field' =&gt; 'field_category');
}