Returns whether the current page is the page of the passed-in term.
Drupal\taxonomy\Plugin\Core\Entity\Term $term: A taxonomy term entity.
function taxonomy_term_is_page(Term $term) {
  $page_term = menu_get_object('taxonomy_term', 2);
  return !empty($page_term) ? $page_term
    ->id() == $term
    ->id() : FALSE;
}