Nothing will be cancelled. IT is YOU and only YOU who is responsible for the documents to work and life in Thailand.
IF you get fired from the job, get the document from your employer, visit the Ministry of Labor and cancel your Work Permit using the same date as last day of employment. Than you visit your local Immigration Office and cancel with documents from employer and ministry of labor your Extension of Stay permitted up to 8th May 2024 using the same last day of employment.
IF you need some time as you need to leave the country, you might apply for a new Extension of Stay, cost 1.900 Thb and if you can NOT meet any requirement it will be NON APPROVED and you get 7 days to pack your bags and leave Thailand.
Cheap option: Visit Immigration Office and apply for the 60 days Extension of Stay based on visiting your wife, this gives you plenty of time to season your money in a Thai bank account
Just to explain: TM30 stands for registration of a foreigner residing on an address in Thailand, so without having an address it is impossibile to report that you are more than 90 days inside Thailand and still living at the same address, this by using the TM47 form.
As you work inside Thailand you only have to show your tax and sso payments of the last 3 months from you and the Thai staff needed to get the work permit.
You can apply during every 90 day of stay you got on entry with this visa and do not have to wait until the visa itself expires