Upvote:8
I have to applaud your inventiveness and perseverance on this topic.
The issue is that the airline won't sell you #1 as a single "trip", but rather as two separate trips (outbound and inbound) on the same ticket, i.e. a return ticket. So when you check-in at CMB, they'll consider your final destination for that trip to be GRU, so shouldn't apply transit rules but entry into Brazil rules, and you don't have a visa.
However a variation on this could be to book a ticket to a country where you can enter without a visa or with visa on arrival, but still routed through the right places. I've tried finding an itinerary starting with CMB-DXB-GRU and ending up in Bolivia (which gives visa on arrival to Sri Lankan citizens) but failed, there may be a few others to try. There could be itineraries directly via PTY rather than GRU as well. As in your plan in your question, you would then skip the last leg and hop onto GRU-PTY-NAS or PTY-NAS instead.
If you find such a combination, a few things to watch out for:
In some places, transit passengers from some countries will actually be escorted by the authorities or staff to a secure holding location and then to the ongoing flight. Or they could keep your passport during transit. Or both. No idea if that happens in GRU or PTY (I think it was mentioned in previous questions that this happens in Mexico for instance). If that happens, you won't be able to switch destination.
When you book an itinerary, if there are any issues, the airline can reroute you nearly any way they want (and is compatible with your visa situation), they could put you on a different routing that does not stop at GRU (or PTY), so you may end up at the final destination rather than the intermediate point you wanted.
I still recommend you try to get a transit visa for either the US, Panama or Brazil (or possibly a few other places), that would make things a lot easier. Have you tried reaching out to the honorary consul of Panama or the embassy of Brazil in Sri Lanka for advice? Even for the US it may not be as difficult as you think depending on circumstances (especially available funds).