If i understand Secret Master's post this can already be done. Apparently the AI doenst invade when there are two units in a port. So withdrawing one would prompt an invasion...I wouldn't like to see hardcoded limits, either, besides the very basic ones. If e.g. France is completely empty and Germany is occupied elsewhere, then I don't see the reason why the AI shouldn't attack. However, if there is no second front, then attacking is just stupid, even if there are several empty ports. How long will they last? A week? Two weeks? A month? Inevitably, they will be destroyed.
Dont get me wrong i rahter see another solution. I think most invasions are too easy and too unrealistic anyways. They just dont take into account the huge amount of planning, logisitcs, etc, involved and the overall strategic situation.
Even the 2 unit port garrisons are not a real solution to the problem which is: If the AI does an invasion there must be a realistic chance of succes without increasing the risk of other theatres being overrun.
For example an invasion of France by the UK in late 1940 would always be unsuccesfull because the English forces would have to face the entire Wehrmacht on their own. But the result would also be a neglect of the African and Far East theatres. Such an invasion would only have a chance of succes if Germany is at war with Russia and the USA and at least a stalemate situation in N-Africa and the Far East occurs.