Refactoring needed to support Structure dependent IMT in scenario damage

Needed to address https://bugs.launchpad.net/openquake/+bug/1154549