Well it's kinda like in Gen V where there were more than 8 gyms. There were 10/ 11 badges in total. 10 for the games (because Cheren replaces Lenora/ Aloe) and 11 for the anime because we don't know what badge Cheren gives out.
The show case was Marlon/ Shizui, Drayden/ Shaga and Cheren were fought after Ash obtained his 8 badges, so it's possible to get a different set of badges.
Unova/ Isshu aside, in Kanto, Gary only has 3 of Ash's 8 badges. The other 7 of Gary's badges are unknown. I guess they just didn't think far ahead enough to make a storyline for the 7 other gyms, or just decided that Gary should be super-mysterious-"genius" type whose movements were not fully tracked. I think it kinda just goes with his character that you don't know how he got to the other 7 gyms to get his 10 badges (which over qualified him for the Indigo League).
Remember Gary was in the Silver Conference in Johto as well, but none of his badges were even seen.
I guess we can just take it as:
a) Gary's character that he's just more mysterious & more together than Ash is (or ever will be,
b) making Gary seem cooler because he knows about junk that Ash doesn't and
c) the storyline writers didn't want to pursue the other gyms' stories, whether due to laziness or lack of time.
Gary Oak - Badges obtained