It's easy to blame the developer and others for our mistakes but in reality, 99% of the errors are user-caused. This isn't saying that there aren't bugs and believe me there are plenty of them in Trainz including some unexplainable behaviour that we cannot and will never be able figure out. We have to keep in mind that the AI will only do what we instruct them to do and not what we think we instructed them to do. We stare at the track marks, we stare at the commands, and our brain says things are okay but in reality, we've sent the AI down the wrong track both figuratively and literally no pun intended. Oh, these are probably the worst and most difficult things to find right up there and next to direction markers facing the wrong direction, by the way.
AI drivers will seek out the shortest path between points. What may appear to us to be a longer path is mathematically the shortest path even if it means taking, often the slowest trip through a yard at 5 mph, instead of taking the 65 mph mainline. The solution here is to place track marker somewhere in the middle of the mainline and instruct the AI to drive via or navigate via those track markers. This puts the AI well past the junctions so they're unable to take a trip through the yard then back up to hit the track marker they missed.
Direction markers really are helpful. They will not only prevent AI drivers from heading into tracks where we don't want them to go unless we drive there ourselves, if used like do not enter signs. They can also be used to direct the AI down a specific track. Us non-left-hand drivers need to use them more often than those in the left-hand driving world.
The other thing to watch for is signaling. I can't stress this enough. Learn the signal types inside and out and copy what is done in the real-world. Seriously. I have found 9 times out of 10 that the AI will follow the signaling pretty well and there are some exceptions where realistic signaling is impossible due to AI and we have to compromise.
In the end, remember that session building is easy, troubleshooting the session and debugging is hard and time-consuming. Depending up on the complexity of the session, this can sometimes take weeks and even months to work the bugs out.