When divorce is final your permission of stay ends.
The hard reality is that living in Thailand requires funds and you indicate thats not in abundance.
Even if you were 50 and eligible for non O retirement, that has financial requirements.
Tourist visas along with visa exempt entries can provide a stay perhaps a year + but it does have limits.
You state this ...
"What if a new marriage comes into the picture? "
Slightly cryptic statement regarding"new marriage " but if you currently have a gf you are unlikely to receive much cooperation from current wife.
It's called between rock and hard place.
Unless you have a job available in Thailand and can obtain a non B then I cannot think of alternatives