How can I add markup above the table in a custom module?
You have multiple solutions to achieve what you want


Using #prefix

 $table = array(
  '#prefix'=&gt; '&lt;div&gt;&lt;a&gt;my link&lt;/a&gt;&lt;/div&gt;',
  '#type' =&gt; 'table',
  '#header' =&gt; $header,
  '#rows' =&gt; $rows,
  '#sticky' =&gt; FALSE,
  '#empty' =&gt; t('No slider created yet.'),
 );
for($i= 0; $i
    $table['#rows'][$i]['data'][2] = $tmp;
}

A better way to do this is

 $table = array(
  'links' =&gt; [
     '#type'=&gt; 'container'
     'link_one'=&gt; [
        '#type' =&gt; 'link',
        '#title' =&gt; $this-&gt;t('Add slide'),
        '#url' =&gt; Url::fromRoute('my_route'),
      ],
   ],
  '#type' =&gt; 'table',
  '#header' =&gt; $header,
  '#rows' =&gt; $rows,
  '#sticky' =&gt; FALSE,
  '#empty' =&gt; t('No slider created yet.'),
 );
for($i= 0; $i
    $table['#rows'][$i]['data'][2] = $tmp;
}

Add module definied actions: https://www.drupal.org/docs/8/api/menu-api/providing-module-defined-actions