2) It can happen without warning. The AI is "omniscient"... it doesn't need to "discover" your start position, nor does it need to assess relative army strengths.... therefore, very often, your first contact with your neighbour is also your first indication that your are about to be dog-piled.
Apologies, I didn't mean to imply that the AI was watching your every move, and reacting accordingly. In the above statement, I was referring to the path-finding algorithm, that allows AI units to advance on enemy cities across non-visible and even un-mapped terrain. I'm not greatly familiar with Civ 6 AI, though I've seen no evidence that, in this aspect, it differs greatly from Civ 4, which I am familiar with. The basic logic is:-
plot path A>B
using shortest route
using best def terrain
You can prove this to yourself by going out 30 or so hexes from you empire, right click and mouse over different hexes in your empire and see the different paths that the computer chooses for your unit to move. For this reason, barbs tend to follow the same approach path into your empire. If A is your starting position, it does require that B, your target hex is known before you move, and I have certainly met, as a first contact, a horde of club- wielding, English hooligans heading towards my territory, with intentions other than tourism..... none of them asked me how to find B.
As far as I understand, the AI rush occurs, due to the extra units given to AI at higher levels at the start. It calculates the relative strengths of itself compared to it's neighbours, possibly considering distance, and quite rightly calculates... you. This doesn't seem to involve a distinction between your units inside or outside of your borders, merely raw strength, as I've certainly had conquests go bad, lose a few units and then be Dow'd by other neighbours. Another argument for building your army against scouting for opportunity.
If you start building an Archer, is it for self-defense or for aggression?
I can only speak for CIV 4, each unit on creation was given a "script" that through a series of numerical values, controlled it's individual behaviour ie:-
Defensive/defense:- sit in city and collect garrison promotions.
Offensive/defense:- patrol home territory and attack intruders.
Defensive/offense:- accompany attackers but attack city last.
Offensive/offense;- enter enemy territory and attack target city.
There were other scripts, but this gives you a general idea. Each unit has an individual behaviour and collectively we see it as an "intelligence". Stack of Dooms were created by production vectoring and relative strength calculations.
I'm not an AI programmer, and I'm sure there are people on this site who can give far better explanations than mine, or even prove me wrong. I'd be interested to hear from anyone who has more detailed knowledge of this when pertaining to CIV 6.