Link's href value gets lost
Looks like the documentation around that theme function is out of date. Please open a bug report for that.

Have a look at template_preprocess_links, it is using url, not href. Also not that url is a Drupal\Core\Url object, not a path, so your code should look like this:

$links[$key] = array(
  'title' =&gt; $definition['title'],
  'url' =&gt; Url::fromRoute('module.show_format.' . $entity-&gt;getEntityTypeId(), array('module_format' =&gt; $key, 'entity' =&gt; $entity-&gt;id())),
);