Your question touches the heart of the Internet and the very definition of routing. In your example, Router D sends data to Computer A based on two premises:
- It's been told to send data to Computer A.
- It's already processed data from Computer A.
Your scenario seems to assume the first option - Router D wants to send to Computer A. But how does it get there? It does so through the use of routing tables which are shared by routers amongst each other.
Router C regularly sends updates to all routers in knows about - including Router D - that it "knows" the "192.168.*" network (in reality - this wouldn't happen because that network isn't routed - it's considered private. But ignore that.) So, Router D already knows that Router C knows that network.
So when data is destined for Computer A, it's addressed by network first. So, Router D asks, "I need to find the 192.168.* network. Do I know it? Nope. Does I know someone else who does? Yes. Router C does. How do I get to router C? Through my 18.104.22.168 interface."
Router D then sends the data to Router C. Router C gets it and says, "Oh, I have data from Router D but it's for the 192.168 network. Do I know that network? Yes, through my 192.168.1.1 network" And then forwards it.
There's some other work to be done to resolve IP and MAC addressing, but I'm covering routing, per se, not ARP and local networking.
You'll notice your first assumption - the remote router must know the routing mechanism - does not come into play here. Router D does not care if Router C is using EIGRP, RIP, RIPv2, OSPF, or whatever. All it cares is that it got an update. (Of course, how it got an update is important to ensure the two stay in synch. But again, that's a different issue.)
Your second assumption - that port number is a factor in routing - is also incorrect. Routers (generally) don't need port information to make routing decisions. (That has changed slightly, due to some new network technologies and applies mainly to firewalls and proxies, but still the broader assumption still applies to "true" routers.)
Continuing with your example, Router C will forward data on port 1000 (per your scenario) because it's possible there is a service on Computer A expecting data on that specific port. But it only knows to do because Router D sent it on port 1000. And router D only sends it on that port because the originator of the data sent it to Router D on that port.
I don't understand your inclusion of bittorrent or P2P programs as reflective of the question you ask. The same explanations would apply. Routers also can be configured with port triggering which associates a particular device (or IP) with a particular port. Such that when traffic comes in port 1234, the routers knows to send data to Device ABCD. This is usually associated with an outgoing TCP port. i.e. If I send traffic on port 7890, the router knows incoming traffic will be on port 1234 and send it to me.
But port triggering is not associated with (remote) routing decisions - instead it relates to the internal MAC/IP table the router uses for the LAN.
Update/edit: To further answer and elaborate after your comment. Router D knows Computer A only by its IP address (192.168.2.2). But Router C knows Computer A by its IP address and by its MAC address. The MAC (Media Access Control) is a unique (usually...) 48-bit identifier that is defined by international standard. Every device connected to a LAN (wired and wireless) are supposed to have a unique MAC address.
The router (Router C) associates the IP address and MAC address together in a table (the MAC address table). So when traffic comes into Router C, and the router realizes its "local" to it, it does a MAC address table lookup. The router then literally changes the frame addressing information.
It reconstructs (rewrites) the Layer 2 destination information to have the destination MAC address of Computer A but keeps the IP address information (Layer 3) to be the same.
If the route does NOT know the MAC address. Or does not have an IP-MAC relationship in its table, it does something called an ARP (address resolution protocol) to ask "HEY, everyone on this network. Do you have this MAC address?" Or sometimes - "Everyone, What is your MAC address?"). The appropriate device/devices responds and the router builds its IP-MAC table.