In the anime, levels do not exist, and battles are essentially done for substance and plot production. This is clearly evident in Surskit using Ice Beam to freeze the battlefield and Vivillon using Psychic to trap Fletchling in a Sticky Web and leaving it defenseless to Solarbeam. Anime battle are a lot more... vivid.
Think about it. If Ash roflstomped Viola, would there be any motive to train with her/challenge her again? No, not at all. Viola would barely see character development, and her character would quickly be forgotten.
Would they have to do five regions worth of training before they can defeat the first gym leader in their home region?
Ash doesn't always have the same Pokemon. Ash actually only had 2 Pokemon on hand during that battle, both of which were not fully evolved, to Viola's Vivillon and Surskit.
So how is an actual beginner (like Serena) supposed to fare against an OP gym leader like her if Ash manages to lose to her on his first try?
Serena actually witnessed the battle, seeing Viola's tactics used against Ashe. Since levels don't exist, remember, Serena could easily use these tactics against her. Also, Serena has Fennekin, which has a type advantage over Viola.