As another poster pointed out, if it were made clear then it would be too easy for the human to circumvent the system, thereby defeating its purpose. As you have admitted, in your case the warning was totally warranted, which shows that it is working as it should.No, I want to attack him in like 5 turns so all my units except 2 random ones are 4+ tile away from their border. And then it's just plain annoying if it pops up. As said, the rules need to be clearer.
Anyway I highly doubt you had only two units on the border in your example. If you look at the way it is coded, you generally need at least 3 units on the AI's border to trigger the message - more if the units are stationed in your own territory.