Bastiodon's his ace, he's not allowed to send it out til the other two are dead.
False, the AI is programmed to save the highest-levelled Pokemon for last unless it detects an advantageous matchup.
Source: me - when I knocked out his Bronzor, he then did switch to Bastiodon. But he didn't switch to it initially.
There is no handheld Pokémon game where the AI is programmed to get around Wonder Guard laterally like that.
Again, not true: the AI in several games is capable of countering Wonder Guard via the use of Toxic or similar moves.
I have a theory for why this happened, but I'm not 100% confident. So, if the switch logic for the AI tells them that they have no effective damaging moves, because of type and/or ability, then they switch out, even if they have ways around it (e.g. a Ghost mon out against an AI mon with only Normal/Fighting attacks but which also knows Foresight). However, I've heard speedrunners say that when the AI is selecting the mon to switch in they don't factor in your ability. The AI knows Shedinja has 1 HP, so it believes that any attacking move will take it out. Therefore, it switches in the next Pokemon in the list that it thinks can OHKO, which is always either Bronzor or Steelix because the default order for Byron's mons is Bronzor/Steelix/Bastiodon (where Steelix is the first reserve) and the order after the initial switch is Steelix/Bronzor/Bastiodon (now Bronzor is the first reserve).
I don't know how much this has changed in later gens, but I'm curious to test it out.
This is basically it. The AI is programmed to try and achieve the maximum possible yield from the current turn, which generally means inflicting the maximum possible damage on the opponent (but some factors override this to take priority, like setting a weather condition, boosting stats, or inflicting status).
If the AI's Pokemon only has one damaging move and the Pokemon it's facing is immune, one of two things will happen: it will use a non-attacking move or it will switch. In Emerald, for instance, Anabel's Raikou only has Thunderbolt as a damaging move; if you bring a Ground-type, she might switch but she's more likely to simply use Calm Mind and Reflect until she's maxed out, then Rest every time she loses HP. Fighting Noland's Gold team in Emerald with a Shedinja demonstrates this even more plainly - none of his Pokemon can damage Shedinja, so his Metagross will use Protect repeatedly, his Latias will boost to the max with Calm Mind and then use Rest over and over, and his Swampert will simply attack at random.
In this instance, Byron's Bronzor and Steelix can't damage Shedinja directly so all he does is switch. Bronzor knows Confuse Ray and Hypnosis, which would both have been valid options to use as Shedinja might then self-KO from confusion damage. Using Sandstorm, too, would have been an effective move because once the storm is set up, I'm dead.
But the AI cannot "see" past the current turn - it's not able to anticipate the Sandstorm damage or factor that in to damage calculations. Thus, switching is seen as a better option than using a move the AI considers inefficient. But a better level of AI would simply switch to Bastiodon straight away rather than just cycling between his other two team members.