The substitution hasn’t been completed just because it has been announced so in your hypothetical situation the player would get a second yellow and the substitute wouldn’t be able to come on or would have to come on for a different player. This actually happened to former Derby player Kwame Thomas who got a second yellow for leaving the pitch too slowly while playing for Notts county.