actually chaos changes the abilities for the units too
but using replace unit would be better in this situation mainly because of how convient it is (replace unit requires 1 action, chaos requires an action in addition to the ability)
if chaos changes produced units (as last i checked it replaced the unit entiraly <tested with morphing of one hero to the next>) then what you can do is make a chaos for each building type and make the tech requirement what race you are then stuff all the diffrent races for the building type into the building.... its kinda hard to explain so ill put it in triggers
Game Start
Pick Every Player
Research Their Race (tech requirement for the chaos ability for their race)
Your ownership change actions
The rest of the game will do the rest
What happens?
When the ownership changes, the player takes out the tech requirement for one of the chaos abilities because they researched the required tech when the game starts. The unit will then chaos (morph) into the new building which if done correctly would be the barracks of that race.