I am not doubting your thoroughness, just noting that it is possible that the defend.ini is triggered only in very specific conditions, and therefore it would be hard to meet them.
If we assume the worst, ie that it is triggered only in one condition, then this one condition could be one in: 6 times 6 (stats) times 3 (AI attacking you, you attacking the AI, AI attacking AI) times 2 (conscript, non conscript) times 2 (city square/non city square) times (1+x) (x being the number of different special abilities a unit can have) times who knows how many else variables. But already these alone make you need to run a series of 36times3times2times2times(1+x)times2y= 432x (so it is in the thousants, and these are not the only variables)
So you should not try to do this.
ps: if you also try to factor the terrains into this (and it is quite logical to do so) then it becomes 432x times a huge factor, since the possibility a unit is in a specific terrain and is attacking/defending another unit in another specific terrain is 1/the number of terrains times 1/the number of terrains. Iirc there are more than 10 different terrains. This means 0.1 times 0.1=0,01. In other words for 10 different terrains there are 100 different possibilities. So it is 432xsquarepowerofY. Oh, also add the existence of a fortress, and you have another 4 possibilities (fort-no fort, fort-fort, no fort-fort, no fort-no fort). So now you have 691200x cases to test (but if and only if the different terrains are only 10; else you will need to run a few more thousant tests to be sure- or rather a few more million, if you factor x as well)
Instead look if anyone ever has seen it happen, and only then calculate which variables are automatically cancelled
