Well, can't say I didn't see this coming. I didn't say anything last night to
Fawfulmk-II's post as I didn't want to be "that guy", but I highly doubted Ash was going to win simply because what would they do if he won a competition? Like I suppose they could then have him battle the Elite Four and lose to one of them so he has reason to continue his adventures to Alola, but for now on we would expect him to always win the League and fact the Elite Four otherwise it would be disappointing. Also we have Sun & Moon being released in just a few months, we kind of need to wrap up the Kalos saga which includes the Team Flare plot, we don't have much time for Ash to face the Elite Four. But hey, Ash did get to the finals (though I argue he should have during Sinnoh and Unova, but whatever), so he's at the footsteps so maybe Alola Leag... oh wait. Er, region league after Alola?
As for how the battle ended, I now the fatal flaw in Ash's team: Ash-Greninja. "WHAT? But Ash-Greninja is Ash's strongest Pokemon"! Is it? Or sure, Ash-Greninja is strong... when the writers want it to be. Oh wow, Ash-Greninja can go toe-to-toe with a Mega! Whoa, Ash-Greninja is stronger than a Mega! Oh, wait, it just got schooled by a Mega... oh, nevermind, it's back to being as good/better than a Mega!... We never had a clear idea how strong Ash-Greninja was, mainly against a Mega. And this is what the writers wanted, a lazy way out. Had they given Ash a Mega *coughCharizardYcough* we would at least know it was even with Alain's Mega Charizard X, but Ash-Greninja, well I guess turns out is weaker than a Mega so gets curb stomped. Oh sure it showed off a bit, but that's all what Ash-Greninja, show off that the writers want to be writing DBZ. Ash-Greninja vs. Alain's MCX is like when Vegeta first went SS to fight Android 17 & 18, Ash-Greninja/Vegeta reaches a new level of strength but Alain's MCX/Android 18 is still stronger so doesn't matter. Though of course that's only to then build up towards Lysandre and Team Flare being a bigger challenge, like how the Androids was just an entree for Cell. Leaving the DBZ parallels behind, once the Team Flare starts up I'm sure Ash will face Alain again and the next time Ash-Greninja will beat Mega Charizard X now with the world in danger (and Ash isn't in the running of becoming League Champion).
Also out of the trainers that have beaten Ash at least Alain was built up to be a strong trainer we got a chance to know way before we even knew he would compete. Ritchie, Harrison, Tyson, and Tobias made their debut at their respective Pokemon Leagues and Cameron was an idiot. In the few episodes which focused on Alain we know he's smart and strong, we know his struggles, and this gave us a chance to like him. We felt sad for him when he blamed himself for what happened to Chespie, we felt dread when we saw him working with Team Flare. While we're sad that Ash lost at the same time we feel a little happy Alain won as this is a major accomplishment after all the Tauros Mulch he had to go through (though that feeling of dread also lingers as now we have a Team Flare member/Lysandre's disciple as League Champion).
We know Alola doesn't have a normal league, maybe what Alola has to offer would help offset Ash's lost by putting him in a special challenge like the Orange Islands and Battle Frontier, you know, the two special challenges he ever won in? Alola could be the thing Ash needs to get another major victory under his belt that isn't a Pokemon League so next region which will probably/hopefully have a League we could see Ash finally become League Champion... only to then get beaten by the Elite Four/Champion. Baby steps, baby steps.