Minmaxing like that is why, if they’re implemented, I’d have it not be based on something quantifiable like kill-count and either have there be a chance for it be positive or negative with a weak bonus or nerf, or have the trait be both be a blessing and a curse.
Something like: Vengeance. Has chance of being obtained after the merc in question is the only survivor of a battle where you started with at least 12 mercs. The other mercs need to have died in battle (so no fleeing and letting them die to try and grind it). Trait does something like: Mercenary never drops below wavering when fighting [FACTION]. Mercenary cannot retreat from battle against [FACTION].
It should be something special that only triggers under rare occasions and which you cannot reliably get even if you know the circumstances under which it triggers (hence the chance of triggering). Also, if you get it, it changes how you use the merc, but does not make them substantially stronger or weaker. Just different.