I've seen this many times. It is very frustrating when the mutual enemy goes after you instead of your main enemy - especially if you're further away from both. Whether this was intentional or not, it is a good thing. If you could keep your distance and let the AI armies go at each other and move in to clean up and win the province every time it would soon get dull.