If we allow modules to store data that's referencing a certain $form_id, then we also have to let them know about vanishing forms.

The module that exposes a form does not have to depend on Form module. Thus:

  module_invoke('form', 'delete', $form_id);

It's unfortunate that we have to force modules to do that, but I don't see another way around it.

This needs to allow modules that integrate with Form module to implement

function hook_form_delete($form_id) {
  // Take necessary actions for $form_id.
}