ask your wife to delay by 2 months the divorce, get your normal marriage extension, then divorce in 2 months, take your divorce and your bank stuff to immigration to change the reason of extension to retirement.
you can apply up to 30 days early if that helps? no you do not need to cancel your current extension, yes you can come back on visa exempt, apply for a non-o and then subsequent extension.
Learn something new every day 🙂 the only stumbling block might be "Some consulates may require medical records to justify the need for treatment in Thailand. ", if the treatment is available elsewhere, such as the home country?
Medical extensions are for those who are unfit to travel, and are for a maximum of 90 days at a time. They are not a way to stay here long term. Maybe your best bet is the retirement extension.