I agree with the issues you've listed.
1. Yes, you are correct. The AI does not realize that an earlier investment pays off more than a late investment.
2. Yes, the AI does not factor in the possibility of a trade to be broken.
I disagree with the conclusions you make. These can be fixed without removing lump sum trades.
1. The AI already knows how to weigh options in a trade. If they dislike you they will offer you less gold for resources or open borders. Your issue is they do not factor in a weight feature when doing lump sum gold vs gpt deals. You are correct, it is probably easier to just remove the lump sum option from the game. Though, I don't think Firaxis will need to hire some new, motivated programmers to expand an existing feature in the game (i.e. weighted trades) to cover lump sum vs. gpt deals.
2. The propositions I made as well as some ideas other members posted are to not break trades upon losing a resource. I proposed that if you lose a resource your either (a) pay back what you owe at a prorated rate (you can even add interest too if you feel its necessarily to suffice your "issue 1") or (b) make the selling player fulfill their end of the deal of a 30 turn trade even if it takes 35, 40, etc... actual game turns to do so. If trades aren't broken, this issue goes away. Option (a) is used in real life numerous places. For instance, the company I work for paid for my moving fees, traveling fees and paid to help me look for a new house. I had to work for my company for at least one year or else I had to pay back all moving fees plus interest. Some mortgages work the same way (the loan helps cover some down payment costs on the condition this house is your primary residence for X amount of years).
If you were referring to strictly a DOW cancelled deal well then I'd say sorry, that's life. The first option to fix exploiting this would be a diplo hit for doing so. You already get diplo hits for DOW'ing so it shouldn't be a hard fix. Your first option should not be "remove a feature". Especially when the only person that can capitalize from the exploit, for the most part, is the human player. I don't know how it factors into MP but if you only SP, the literally easiest way to fix the exploit is simply not to use it.