Car insurance here covers damage to the car. It covers any driver. I guess a foreigner could be excluded, no experience here as I've never had an accident, or been stopped by RTP. Occasionally they wave cars through a road station, but again, never been stopped or had to display my DL.
Everything else gets negotiated, in the event of an accident.
Assuming you survive the accident, and the resulting angry crowd attempting to beat you to death (this why most Thais do a runner), and the pick-up truck ride to the hospital, you'll probably have to fork out hundreds of thousands of baht to the police, and anyone else nearby.
No level of insurance will cover everything. Pretty much just repairs to your own car.
I think the IDP is "legal" here, but of course, that is subject to interpretation by the police in any given instance. Many folks say their home country DL is more likely to be acceptable. There may be some caveats re: long-term usage when one should probably get a local license. The fact that you can get an IDP at a post office, or AAA, for a spot of cash doesn't exactly instill confidence. I don't think you can convert an IDP to a Thai DL, but you can convert some country's DLs. I was able to get Thai DLs based on my U.S. State DL.
Yes, I imagine there is a driving code, maybe more than one even? It is hardly relevant. You can root around in the DLT (Department of Land Transportation, part of the Ministry of Transport) site for something.
http://thailaws.com/law/t_laws/tlaw0140_5.pdf
When I renewed my car and motorcycle licenses recently we had to watch a one + hour video. In this video, the drivers did not wear seatbelts, and it mostly dealt with courtesy. Wai to the other driver, etc.
Thais can buy a license quite cheaply. Not so long ago people got lifetime licenses.
The number one rule: Don't hit anything or anyone.
Other advisories...
Avoid driving at night
Avoid driving in inclement weather
Watch out for motorbikes passing on the left, right, approaching on the left and over the top.
On divided highways heed the upcoming U-Turn signs, and slow. A tandem trailer, or farm jitney, could be cutting across all three lanes.
Thais love to arrive at the narrowest part of a road simultaneously, and odd coordination of multiple motorbikes, cars, trucks, buses and trains.
Approach level RR crossings carefully
Driving in Bangkok is hardly challenging, traffic moves at what, 6 Kph?