I am trying to display the number of comments in the node teaser links as a comment bubble with the number only. In order to do this I need to get some markup around the number and the "comments" text, so I can hide the text and display the number inside the icon. I am trying to do this using hook_preprocess_links but I can't figure out how to override the link text do add the markup I need. I've gotten this far:

function mytheme_preprocess_links__node(&$variables) {

  if (isset($variables['links']['comment-comments'])) {
    $title = $variables['links']['comment-comments']['link']['#title'];
    $count = 7 // need to get the actual count in here.

    $variables['links']['comment-comments']['link']["#title"] = \Drupal::translation()->formatPlural($count, ''<span class="comment-count">1</span> <span class="comment-text">comment</span>', '<span class="commment-count">@count</span> <span class="comment-text">comments</span>');
  }
}

When I dsm the $title variable I can see that the comment count is in there, I just can't figure out how to get it out into the $count variable. Any help?