>>55846251SM was a deliberate Yo-kai Watch clone and lost the ratings battle at first. Then the demographics shifted, new and younger japanese kids started watching TV, Yo-kai Watch's popularity dipped due to overexposure, and then Pokemon Go happened.
The Pokemon GO craze came and Pokemon's fanbase in Japan exploded, just like everywhere else in the world. Demographics shifting renovated the franchise and brought new kids in after Gen VI's failure. SM was at the right time and right place to soak that up, but people remember Alola characters more fondly from the games rather than the anime, since Pokemon Go and the 20th anniversary gave it a lot of publicity. Basically, SM Game > SM Anime.
So no, the anime wasn't good. It got its ratings by proxy and people just rolled with it when Ash was awarded the league through asspulls.