One possible analysis could be that in such a fanfiction, the idea of Ash being betrayed might be a way to create drama. It could involve his friends or companions in the harem turning against him for various reasons like jealousy or misinformation.
It could be his rivals. For instance, Tracey or Paul might see Ash's potential in the new region as a threat and decide to betray him. They could try to sabotage his battles by giving false tips to his opponents or stealing his battle strategies.
Ash would be extremely hurt. He's a very loyal person, and having someone he cares about like Lillie betray him would be a huge blow. He might initially go into denial, not believing that Lillie could do such a thing.
In many such fanfictions, the plot might involve Ash's friends suddenly turning against him due to some false accusations or misunderstandings. For example, they could believe that Ash has been secretly working with an enemy group, which leads to his betrayal.
Well, it might be that his rivals in the fanfiction somehow manage to deceive his Pokemon into thinking Ash is a bad trainer. Maybe they spread false rumors about how he doesn't really care for them, which causes the Pokemon to betray him. This would shatter Ash's world as his Pokemon are his closest friends and partners.
One common plot is that Ash's friends or some of the female characters in his harem turn against him due to a misunderstanding. Maybe they think he has some ulterior motives or has betrayed their trust in some way. Another plot could be a new character coming in and manipulating the situation to make it seem like Ash is the bad guy.
You can try fanfiction websites like FanFiction.net or Archive of Our Own (AO3). On FanFiction.net, use the search bar and type in 'Pokemon Ash Betrayed Harem' to see if there are any relevant stories. AO3 also has a large collection of fanfictions, and their tagging system can help you locate the specific type of story you're looking for.
There's also a chance that an old enemy from Ash's past resurfaces. This enemy, who has a long - standing grudge against Ash, could find a way to use Ash's Pokemon to get revenge. They might have developed new techniques or powers over time that allow them to influence the Pokemon's loyalty.
It could be a rival trainer. Rival trainers are often very competitive in the Pokémon world. Maybe this rival is jealous of Ash and May's progress and decides to betray them to slow them down. They might spread false rumors about Ash and May, causing other trainers to be distrustful of them.