The Pokemon's old type is only relevant if its tera type is Stellar (in which case its defensive type matchups are unchanged) or for the purpose of determining what types it should get STAB on. An innate Ground type that becomes Tera Ghost will no longer be weak to Grass or Water, nor will it be immune to Electric (unless it has an ability-based immunity, such as a Rhyperior with Lightning Rod).