I don't think if exist a direct solution, I just can think using "Replace <unit> with (Unit-Type of <unit>)" but that create an another different unit of that building, so if you have it stored in a variable or hashtable, so you have to re-assign it, if not, so you won't have problem.