It's effectively a base-targeted self-only mass teleport. Make a dummy ability that does nothing and add it to the unit. When that ability is cast, add your custom Mass Teleport to the unit, and order it to use the ability on the base. When the spell cast ends (there's an event for this) remove the MT ability from the unit.