I wouldn't call it a "bug" so much as "a knowing sacrifice made in the efforts of improving overall performance of the game." AI is a pretty intensive process on your computer, so the AI is set to turn itself down to a notch below Lenny from Mice and Men when you're not there. It can lead to some quirks, like when hostile NPCs are standing next to each other, but you're not in the area to make the computer think it's worth making them behave like they should. The OnPercieve event fires when they see each other, but the resource-saving AI says it's not worth fighting yet. When you show up, the AI is revved up, but they've already seen one another and thus call no new OnPerceived event. As they're not in combat (because they never started) they don't look for new targets at the end of the round and just stand there stupidly. Potentially scratching their posteriors.
The first fix works because it's a workaround of the script. That is, it never gets a chance to decide against fighting, because you've added a line to make them fight. The second script works because the AI setting variables take precedence over any AI-reducing schemes to save resources. If the plan is to just make them mindlessly beat each other (like NPCs sparring in an arena), I'd be inclined to wipe out their entire AIs and just order them to attack one another as part of the OnPerceived event, perhaps with a simple check in the heartbeat to see if they're out of combat (and to start if they are) in the case of a module that's expected to run a long time. It would give the benefits of saving the resources spent on the fight and still allowing players walking by to see the fellows pimpslapping one another with great vigor.