Get the Emergency passport, travel abroad, come back with the Visa Exempt Entry, wait for your new passport and start the visa procedures all over again, starting with new Non Immigrant visa for 90 days and than the 1 year Extension of Stay
To apply inside Thailand for a new visa, you must meet the requirements and NOT all of the over 80 Immigration Offices have the permission to issue visa.
The question now is:
Does the office you visited have permission to issue a visa?
Did you meet all the requirements, like entered with a Visa Exempt Entry OR Tourist Visa, did you have enough days left as this application goes under consideration?
IF an Immigration Officer told you to go abroad to apply, I'm almost certain that the answer on one or even both questions is NO
some said, but even when it makes sense by foreigners it does not mean it is correct.
This is a copy of the police order.
BTW it is NOT a retirement visa, but an 1 year Extension of Stay based on being over 50 years of age and willing to sit out the rest of your life in Thailand, (shortcut retirement)
You might want to choose for the alternative and let your wife apply for the Non Immigrant O visa based on visiting Non Thai Family which has NO financial requirements and once in Thailand she can apply for matching Extensions of Stay based on your Extension of Stay, which for her does not have financial requirements.
They love to call it the "piggy back visa" on this page
As you write you are on an Extension of Stay and you signed the document that you understand the rules and regulations.
why ask if you understand the rules, but okay, your employer is WRONG.
According to the signed STM2 form YOU need to cancel this Extension of Stay using the last day of working as the last day of this permitted to stay period.
AS you also signed documents to get a Work Permit it is YOU who has to cancel this work permit at the Ministry of Labor.