How does the 'battles won' work after June 2017 gym update?
Solution 1:
Based on personal experience (and your own, it sounds like), the Battles Won stat now refers to the number of times it has been on an attacking team that has defeated a Pokémon in gym battles. This number used to represent how many times it defeated the last Pokémon of an attacking player's entire team it defeated, but this was changed during the gym rework.
From this Reddit thread:
I'm not sure if this is widely known, but the "Battles Won" that shows up on the pre-battle splash screen is not how many times that attacker was the victorious Pokemon when you defeated another Pokemon. It is actually how many times that attacker was part of a team that defeated a defending Pokemon. I noticed this because a Machamp I just caught from a raid had 15 victories this morning and I was pretty sure I hadn't used it that many times already. The 15 victories, though, referred to the 5 Pokemon I had beaten in a gym 3 times each last night even though I didn't use Machamp for each individual fight.