The line of sight rule only applies to trainers with their Pokeballs on their belt. Otherwise, how else can you spot a Trainer? It's like how a katana displayed in a home showed the status of the country; edge upwards means war whereas edge downwards meant peace.
In Johto, a belt of Pokeballs means they were looking for a duel.
This is how service Pokemon or companion Pokemon are not immediately accosted for battles...no belt = no battle.












