In the main games, Trainers often have a set order that they send out their Pokemon. For example, the Fire-type Gym Leader Kabu will always send out Ninetales first, then Arcanine, then Centiskorch. He will never send out Centiskorch when you defeat Ninetales. I think that you should be able to make Trainers in Pixelmon that use the same logic if you want to.
By default, Trainers will keep choosing the best switch-in like they currently do. But you can check off a setting in the NPC Editor that would make that particular Trainer send out their Pokemon in order.
As for what happens when you use a move like Roar or Dragon Tail, I think that whatever the main games do should be done when this setting is checked off in Pixelmon.
However, I'm not sure how Advanced AI would handle this (maybe the option shouldn't be available for it).