If you reach rank 20, you're also guaranteed an encounter with the legendary Pokémon which is in five-star raids at the time you reach the Pokémon encounter reward. Guaranteed Pokémon encounters will always occur, even if you don't earn enough wins on that encounter specific rank.