How to retrieve a term tree for a specific vocabulary given the machine name?
The vid field is the machine name for a vocabulary in Drupal 8.

You just need to pass the the string you have to TermStorage::loadTree, it doesn't need to be altered. For example:

$terms = \Drupal::entityManager()-&gt;getStorage('taxonomy_term')-&gt;loadTree("myname");