As far as implementation, it would be kind of easy, just add a button to the building with the cost in ore and time and the player would it it and it would expand. (I assume).
Here is my concern. If expanding underground just takes time and ore, and costs less to expand per unit (being people, ore capacity, etc) than to build a new structure, then the player will always opt to expand the structure over building a new building, so why have the feature?
If expanding underground costs more to expand per unit stored than a new building, then players wont use the feature and just build a new building.
The important crux of the issue, as presented by the OP, is the ability for colonists to survive if the building is destroyed. I think that this is the focus of playbalacing this idea, if it is to enter in game -- how detramental losing colonists vs the cost needed to help save them from attack.