You can apply for the DTV while you're already in Thailand on a tourist stamp.
The Thai e-Visa system now flags IP and GPS location, and 2026 applicants increasingly face a Location Verification step requiring a utility bill or driver's licence matching the country of the embassy they applied to. Applying from inside Thailand is a rejection.