It's probably too late already -judging by the date in which this was posted- but I'd like to throw my two cents in here anyway, because I had something similar happen to me in Gen 2 and it wasn't fun to deal with.
Ideally, you can still get lucky enough for them to obey you at least once or twice a battle, which at that level should be enough to defeat the trainers on the gym, but you should be careful not to let them accumulate that much XP after they do so, because they would get even more levels and your problem would only increase. I recommend switching out after a successful hit is landed. Yes, it is tedious and doesn't guarantee anything, but it is still better than losing to yourself.
What are the two Pokémons you currently own? I'm pretty sure you can catch something that's equally as effective to defeat the first gym with with just a bit of training. Also, you can get the Elemental Monkeys as a gift at the Dreamyard, which should save you a lot of trouble. Hope this helps!