In fact developers could lose money (in addition to losing a legitimate sale) because of credit card chargebacks for fraud because those sites are often just laundering places for stolen payment information
At that point just pirate it unless you're trying to play a game online. Also if you were unaware g2a uses stolen credit cards among other morally dubious methods to get their game keys. You probably shouldn't be supporting that regardless of your reasoning.
Quite frankly, I don't know why these sites have such a reputation...
While I'm sure sketchy stuff has happened (and things like selling steam accounts is against ToS), most of the more well known sites seem to make money off of sales and limited time products, or direct from developer keys. They buy it on sale, they sell it for more then they paid. Or, they buy it at regular price but then the product is discontinued (like some dbd dlc for example), so they can sell it for more. Or the developer makes the keys and sells them on these sites as a way to get around steams restrictions.
If they were always a front for stolen or fraudulent goods do you really think they wouldn't have been shut down by now?