You can also repeat the league if you lose, main difference is that you just have to wait another year.It is true in every series where Ash start over with only Pikachu, he find new unevolved pokemon and train them from zero. Starting from the weakest gym and ending with strongest gym as his pokemon get stronger by time.
Even one of the purpose of gym match is for the gym leader to give advice to trainers. There is a reason why it is called gym. Gym is place for training/exercise.
When you lose you can just repeat (nothing to lose, not even rank), unlike league match where you are eliminated if you lose. Clearly just training phase. It is like school phase vs work phase, it is okay if you make mistake at school but not at work.