About TR yields:
What about this very simple rule:
When an internal TR is established, each trading partner gets 10% of the food and production the other city has.
This would accomplish the following things:
Reliable, relatively constant, easy-to-understand yields
No weird "zero-yield" TR's
Easy balance by changing the percent value
No difference in TR direction - less micromanagement
No overpowered yields created out of thin air
Small cities would profit more than larger ones
I saw that suggestion, actually, but didn't get around to answering it yet. The yield formula is almost certainly in the DLL. It is in the DLL for Civ5 and it's highly unusual for calculations like this to be done in a game script.
As far as I can tell, without ripping out the whole trade route system and replacing it with a Lua-based version, you can't mod the basic design. Perhaps you can change the total yield, but it will always be the same difference-based formula.
There are some things you could conceivably do, like implementing a hack to make sure that trade routes always go from the high-yield to the low-yield side, and probably adding a recall button, but you can't just change the yields to 10% of the production for each city.
If I may offer some comments, I don't think I'm a big fan of your design, as I rather feel that it doesn't quite address what's basically wrong with trade routes. If additional yields are created, you will always want to hook your city up to the best existing production city, which is part of what makes trade route management boring for me in its current form. There's little real optimizing going on, it's mostly micromanagement and a little bit of juggling marginal gains.
In my opinion, it would be better if trade didn't create any additional production or food at all, but just moved it around. There could, perhaps, be a small energy yield (representing tariffs or whatever), but for hammers and food the use is already in an increased marginal gain as long as the early builds and pop increases remain more efficient and health mostly remains local. On the other hand, losing production in your hammer city means you don't want to allow an arbitrary amount of trade from it. This would also go some ways to make ICS more difficult by putting production back to the cities and making it harder to set up multiple cities at once.
International trade should also be done differently. For one, it should depend on the diplomatic status more and should only go along roads, rivers or the sea. I agree with you that having to protect trade would also be very interesting for a high-risk/high-reward situation. I'd also add some kind of distance tax that makes very distant trade routes less efficient.