okay perhaps paying tax is possible in the situation described by the OP. However, this work will be illegal in Thailand when a foreigner doesn't have a proper visa and the work permit. Will the immigration and labor office find out that the foreigner works illegally? Do they care?
Foreigners can't just be freelancers, getting paid to their thai bank, and pay tax here. The DTV visa allows being a freelancer with a condition that he/she is paid to their foreign bank and pay taxes in the country their bank acc is in