If you have a unit nearby another AI's city when it is founded, before the influence/borders appear, and then the influence/borders appear around the city with your unit inside them you cannot move your unit without starting a war.
If the unit remains immobile no popup for the territory violation occurs.