Technically you can stay out until the day before your visa expires, it will be mentioned in the reentry stamp. However, unless you have written permision from your school saying how long they are allowing you to skip lessons and a good idea would be the why, you could be refused entry. So if they give you 3 weeks in the letter, you have to return within the 3 weeks.
but you also have to consider in the worst case scenario, that if you get a remittence of 800k from an agent in the year you become a tax resident, you are liable for the tax on that for the next 5 years.
he means that if you know your moving next year (and will be tax resident next year), any money transfered this year to Thailand is not treated as assesable if this year you spent less than 180 days in Thailand.
Presumably if on an extension you will have a current work permit to work in Thailand. This needs cancelling and returning to DWP before you leave and cancellation of business visa at IMO. You need supporting document stating last day of work. You will probably have to request a denial of extension stamp giving you 7 days to leave Thailand, depending on your timeline. Expect extra scrutiny in the embassy in LAOS on your paperwork, as to the sudden change in your circumstances, one day working in Thailand, now not going to work in Thailand but having an unbroken income stream.
you can come in with no visa (visa exempt) for 60 days plus another 30 while you get the lay of the land, and at any point take a trip to a neighboring country embassy to kick off the visa process suitable to your plan.
Don't rush into a DTV if you arent sure what your plan is within Thailand. Your signing up for 5 years of no legal work within Thailand, other than international remote work, and its not an easy thing to change from 1 active visa type to another, Its not like existing visa's where you can simply do it at extension time changing the reason, or leaving the country without a re-entry permit to cancel it.