Show only terms that have been used?
An easier approach without really coding a lot would be to create your search with Search API and/or Facets.

Facets are designed to expose only options that will return results.

https://www.drupal.org/project/facetapi

While you would have to rebuild the View, it probably is not a huge deal - and you won't have to write a bunch of code every time you expose taxonomy or similar fields as facets.