The anime has presented a theory that sometimes, after evolving, a Pokémon's personality can be different, and as was the case with Ash's Charmeleon, the Pokémon no longer considers their trainer as truly worthy of their new-found strength. This kind of mirrors the system in the games where an over-levelled Pokémon will usually ignore the trainer's commands in battle, but earning a new badge isn't a quick fix. The anime is more focused on presenting a constantly evolving bond between Pokémon and trainer, and a trainer must be able to prove themselves. Perhaps it is reasonable that there were flaws with Ash that Charmander couldn't see until it gained a new pair of eyes. Another theory is that since the Pokémon this occurs with are select, it is more a sign of incompatibility of personality, but it tends to occur more frequently to beginner trainers. I would think that experience and/or maturity as a trainer is definitely a factor. There was an episode in the Orange Islands arc where Charizard was badly wounded from a fight, and it was after Ash stayed up most of the night to restore its strength that Charizard first started obeying him, symbolising a mark of true recognition for Ash as a trainer. Iris and Excadrill share some similarity, but it was revealed that this occurred from a particular battle after having evolved, rather than being linked to the evolution itself.
There are, however, many cases in the anime where not only does the bond between trainer and Pokémon seem enhanced after evolution, but the act of evolving seems to happen with very fortuitous timing, such as Cameron's Lucario and Serena's Sylveon. This, and the fact that mid-battle evolution is possible, are indicative of the anime aiming for a more "realistic" interpretation of the relationship between Pokémon and trainer, that is based more on the power of friendship than game mechanisms like badges or level caps. Remember the same thing happened with Ash and Pikachu in the very beginning, and it only took half an episode to fix, after Pikachu saw how far Ash was willing to go to protect it. "Get in the ball, it's the only way! COME... AND... GET ME!" Essentially, the anime establishes the premise that the bond of trainers is what allows Pokémon to become stronger. All the examples covered (Pikachu, Charmeleon, Mamoswine, Excadrill) were Pokémon with beginner trainers lacking in experience, something that became more pronounced upon evolution. As with real life, there are no quick fixes for rough patches in a relationship, regaining another's loyalty is something that cannot be bought or bargained for.