Yeah, there are various incentives issues like this one that are definitely worth thinking about! I wrote about some of them in this blog post: https://ericneyman.wordpress.com/2019/09/15/incentives-in-the-election-charity-platform/
The issue you point out can be mostly resolved by saying that half of a pledges contributions will go to their chosen candidate no matter what—but this has the unfortunate effect of decreasing the amount of money that gets sent to charity. My guess is that it’s not worth it (though maybe doing some nominal amount like 5% is worth it (so as to discourage e.g. liberals who care mostly just about charity from donating to the Republican candidate).