While I agree with it being difficult to know their age, he could have used common sense.
If in doubt, don't put your dick into it. That's a pretty sensible rule of thumb.
Aside from that, Thailand is known to be dodgy. Its world famous for that. It isn't beyond comprehension that underage prostitution may occur.
Unless, the person is totally retarded.
Why can't you expect a foreigner to know Thai law? They don't need to pass the bar or anything, but basic laws like age of consent, prostitution, drugs, speed limits and such should be known, if you are getting involved with that stuff.