Avoid KeyError tearing down extensions.

Extensions are torn down in random order as keys returned from a python
dictionary and thus due to the dependency handling the top-level
requested module might already be torn down. Perhaps.

https://bugzilla.gnome.org/show_bug.cgi?id=702518