As digital nomad i went 2 times in Mexico for 6 months the last 3 years. Mexico is the easiest country regarding visa's. As long you do a visa run every 6 months, you can come back. But espacially in high season Yucatan can be more expensive cause all of Americans and Canadians staying the winter there. But if you can rent something long term it must be ok. I had a studio for 400 usd a month 15 minute walk from the beach. near the beach prices are higher ofcourse. A friend wanted to buy real estate in PDC, but the prices are high. First time i was in PDC 25 years ago it was just 1 street and a ferry to cozumel.
Isla Mulheres is nice, but could become too small for you. Cozumel the same. The Island Holbox is developping, not good internet yet and high prices. Just go there and have a look some months

Merida could also be an option for you. But don't forget, is realy hot some parts, and not the nice heat. PDC you pay high prices to sit on a beach full of stinking seaweed. Therefor Isla Muljeres and Cozumel have nicer beaches. Some part of the beaches in PDC are better kept.
The other part Puerto Vallarta / Sayulita could also be interesting. But the realy cheap parts are at the other coast, Puerto Escondido, Huatulco, Zipolite. I saw a lot of retirees in San Miguel de Allende, but no beaches there but good climate.
I also stayed some months in mexico City. But when i was there during the earthquake i left. I would never live in Mexico City, not an experience i want again. I was in hurricane season in PDC, but nothing happened.
Brazil has become cheap cause the BRL went down harder than USD or Euro. Is 40% cheaper there than 5 years ago. And i expect the BRL to go down more, this year there are elections.
Personaly i wouldn't live in PDC long time. Too many tourist, not a nice heat, busy stinking beaches and i want more green around me.