Does hook_drush_exit() get called for disabled modules? I have a module that exposes a drush file that contains an implementation of hook_drush_exit(). This function gets called at each drush command, even though the module is disabled. 

Is this behaviour by design, or is it a bug/misconfiguration?
Using Drush 7, I get different results -- which is to say, hook_drush_exit() is usually not called unless the module it is implemented in is enabled.

Two things to note about this:


Earlier versions of Drush may have behaved differently; I did not test older versions, and I do not remember.
In some instances, it may be possible for some hook_drush_exit() to fire, even if the module it is not enabled.  One example where this happens is the drush help command.


hook_drush_exit() will be called for all commandfiles (module.drush.inc) that are loaded.  If Drush bootstraps the Drupal site all the way to the configuration level, then it will only load commandfiles for enabled modules.  If Drush is going to bootstrap the Drupal site at least to the "BOOTSTRAP_DRUPAL_ROOT" level, but not all the way to the configuration level, then it is not possible for Drush to determine which modules are enabled, and which are disabled.  In these somewhat rare cases, Drush will go ahead and load all of the commandfiles it can find anywhere inside the Drupal root, even for modules that are not enabled.

In any event, the workaround you used is the right solution, but now you know why your hook is being called.