How to remove tag from SelectQuery object
I still can not find a way to remove a tag from query, but I found solution for my case of count query. The idea is to use another tag to stop endless recursion:

function mymodule_query_mytag_alter(QueryAlterableInterface $query) {

  if ($query-&gt;hasTag('counted')) {
    return;
  }

  // Prepare count query
  $countQuery = $query-&gt;countQuery();
  $countQuery-&gt;addTag('counted'); // Abort hook recursion

  $tables =&amp; $countQuery-&gt;getTables(); // Query may have sub-queries

  foreach ($tables as &amp;$table) { // Tag all subqueries
    if ($table['table'] instanceof SelectQueryInterface) {
      $table['table']-&gt;addTag('counted'); // Abort hook recursion
    }
  }

  $total = $countQuery-&gt;execute()-&gt;fetchField(); // execute() will initiate recursion!

 // Rest of processing

}