Say when a faction of a type (roman, eastern, etc.) is destroyed by the barbarian player, for the player to get access to their buildings and units.

My first question is it possible at all. And the second question, if it is possible, what would go into making such a mod, at least in broad strokes?