Variable passed into a preprocess function has incorrect data or or an unexpected format
It happens because template_preprocess_forums(), which is executed before any hook_preprocess_forums() implementation, overrides $variables['topics'] with the render array for its table. 

It would have been better to put the render array in a different array value. As you notice from the function code, starting from Drupal 8.6.x, the original value of $variables['topics'] is available in $variables['topics_original'].

  $variables['topics_original'] = $variables['topics'];
  $variables['topics'] = $table;
  $variables['topics_pager'] = [
    '#type' =&gt; 'pager',
  ];