this mechanic is in the game for a long time just not implemented but it has been used in some mods.
ie. siege tank switching between cannon mode and ballista mode while attacking siege/nonsiege units.
not sure if they improved the mechanics altogether, because its kinda jenky atm.