questions about theme api

on this page

the 2 code samples at the top show 2 different ways to use theme api

in the second one the name of the theme being use (form, pager ect) appears twice
both as the name of the array ( $build[‘table’] ) and as one of the key value pairs stored by this array (array(
‘#theme’ => ‘table’, ….. );)

why is it necessary to mention the fact that it is a table twice?

also, does the theme API work the same in D8

Drupal version: