From memory, I think the green, yellow and black wires are all the same gauge, the green wire just has thicker insulation. I need to verify that.
The yellow wire connects to the transformer 15V Post, the black wire to the transformer Base Post, the Green wire to the control button, then on to the Base Post. How the wires are landed inside the accessory is irrelevant to the Gilbert wire color usage. Remember, even if some of the metal in the whistle is connected to the yellow wire it is ok because with 2 rail track the metal track ties are insulated from both rails so there can not be a short.
When I get home after this trip I will get out one of my 577's and meter the connections and metal frame to see if any wires actually are connected to the frame. In the interim we should avoid the term "ground" unless we are referring to the house ground. No Gilbert transformers were ever made with a ground connection. The transformer chassis floats, it is not connected to any of the transformer winding wires. The Base Post is simply the zero volt reference for the fixed and variable voltage posts. In most Gilbert dual transformers the two Base Post terminals are internally connected but in some Gilbert transformers they are not.