The AI is in it to win it, and thankfully so.
The problem is that the AI is hurt by starting pointless wars...if the player is approaching victory the AI should band together and attack instead of starting separate useless and likely even beneficial (for the player) skirmishes. For example, I often provoke the AI into declaring on me just so I can save myself the war declaration warmonger malus to have an easier time diplomatically with the other civs. This is not about making the AI less aggressive but about making it use aggression in a smarter way.
Thing is, doesn't that double penalize a lesser warmonger?
Well, war is risky and one really shouldn't lose so much
If the competent warmonger gets declared upon by incompetent and weak civs he will grow more quickly so I think it would probably have more of an anti-snowballing effect, especially since military strength assessment will then lead to his neighbors focusing more on their own military (right?).
But how do you do this, easy, without much coding?
That certainly would make the addition easy to code; however, I worry if there aren't any additional side effects, especially when vassals or DP partners are involved. Is it not the case that a vassal will win the war, even if he was almost obliterated, as long as the master wins? And as you already alluded to with the reference to joint wars, which happen quite often, the DP partner or offensive partner could win just because the victim was mostly busy fighting the player at the same time. I think these effects could really skew the system.
Counting kill ratio would be more complicated but would also suffer much less from these effects, since the war outcome, which is influenced by a great many different things, doesn't play a role but instead the attempt would be to assess only the raw combat skill.
There must be some sort of unit valuation in the game already, since different policies, which give yields per unit killed, vary their yields with a stronger unit giving more (is it simply strength?) so this could be used as a metric to count how much "unit asset value" the player has destroyed and has lost; this measure would then be multiplied by the result of the total asset value involved plugged into a logarithmic function, to give it a "statistical significance" component so that abuse in the sense of starting a war with someone who can't fight back much for whatever reason and sniping a few units to get a good ratio and then offering peace isn't possible. Values from earlier wars are then attenuated to lessen the effect of things like unique unit era for the civ, lucky constellations and any other impact factors that can change over time. What you have now is a factor that can increase of decrease the military score and should probably have less side effects (I think).
So basically:
After each war, no matter whether won, lost or stalemate:
CUVK is the combined unit value killed
CUVL is the combined unit value lost
SF is the strength factor that depends on the unit values assigned; it is a constant that should scale with era and have the value of about [ 20 * (EraNum / 2) ] typical units (asset value) of that era.
MilitaryScoreMultiplierForCurrentWar = 2 / ( 1 + e ^ -( ln( CUVK / (CUVL + 1) ) * log( ( (CUVK + CUVL) / SF) + 1) ))
(the output here will always be between 0 and 2)
and then for the previous wars, for each the values were stored and are now attenuated toward 1 using the time passed since they occurred:
MilitaryScoreMultiplierFromPreviousWar = 1 + ( (MilitaryScoreMultiplierFromPreviousWar - 1) / ( 1 + (TurnsPassedSinceThatWar / 75) ) )
and then we form an average from all of these but multiply the most current multiplier by the total number of previous-war-multipliers and voila....we now have a factor that is always between 0 and 2 with a strong tendency toward 1 that takes a whole bunch of stuff into account
Have mercy on my soul, I don't create many algorithms
Edit: forgot to update my description after I made the actual algorithm...updated 5 mins after posting
Edit2: forgot a minus sign in my logistic function