The/A highway code is a western concept that has evolved in the west over years in societies that have a long culture of driving. It is not just Thailand that has this sort of regular chaos on their roads but pretty much all Asian countrys, and many other places too. These countrys have really only had large scale personal motorised transport for 2-3 decades. Safety and common sense, in a western fashion, is not really compatable to these places or cultures, especially when they all suddenly can control a mechanical vehicle for their own ends and until recently they were unaware of it's existance or it was the preserve of the rich or elite. Kids with new toys springs to mind.
Many of the Thais, whether on bike or pickup/car, often rely on the fact that the other person will simply not want to cash into them, hence the rude way so many drive. This, and a few other cultural influences like face/religion/nurture etc, encourage this sort of risk taking behaviour or encourage them to be oblivious to danger.
I think, still only 50% of bike riders wear a helmet and a good percentage of that 50% are wearing the plastic free one you get with the bike that only protects you from the police.
Anyone ever seen the "theory" side of gaining a drivers license here.

Woeful hardly does it credit.
The girl in Pete's story is lucky.