I can help just partially.
Yes, the green-red wire is indeed providing ground from both hydraulic switches that are on the sides of the transmission. They have eyelets at their ends that go under the black thumb nuts on the switches. The wire goes from the right and left hand side switch, to the plate with connections and one wire goes from there to engine bay in harness (in some cars I have seen these wires meet at the left hand side switch and then one wire put to the harness to go to engine bay).
On your pictures I see one eyelet hanging and one of the switches not connected - it is probably the eyelet for this switch.
The harness is not available to buy, but those wires are easy to re-create.
In my car (non US) this one wire that goes to engine bay, goes (provides ground) to Constant Speed Solenoid - and CSS' job is to be activated when one of these two hydraulic switches on the sides of the gear box feel the oil pressure inside as the gear (R or D) is selected. They provide ground to CSS that is powered from fuse 5 and when CSS is activated, it pushes the linkage to increase idle to compensate for the load on the engine related to gear selection and thus preventing engine from stalling.
I am not sure, however, where this wire/ground goes in your case - you say to the relay, which suggests you have Emission Control System, that I am not good at. In the US cars with Emission Control CSS is not responsible for pushing the linkage to increase idle upon gear selection, the EC system does it. CSS may still be there, but it is used for Air Condition (same function - help engine), or it is not used at all, just stays there if a car does not have AC.
There is a cover for the connector plate on the gear box, PN A 112 257 04 90, available, ca $30. There is no cover on the connector plate for the starter/alternator (just anticipating one of your subsequent questions).