OK. You are dealing with the secondary side of the transformer. You are not going to get a shock from 18 VAC. That is why it is OK for the track to sit at this voltage. A greater concern is the current that would flow in a short, a fire hazard, but the circuit breaker in the transformer is intended to take care of this.
Another reason is the secondary side of the transformer may not be referenced to earth ground so a fault to outlet ground would not have any effect. However, if you have a TMCC base it will connect earth ground to the track so there would be some current flow if the hot side of the transformer contacts your grounded case. Again this would appear as a short and the circuit breaker in the transformer should protect from this.
The metal posts in your basement are not suitable for a ground connection. The highest quality ground you have available is from the outlet unless you run special wiring. A water pipe ground should not be used for protection. For example, I have used a water pipe for the ground connection to a shortwave radio.
To accomplish what you want you can connect the transformer common to your box with the intent to trip the transformer breaker if a hot wire contacts the box. Unfortunately, the common terminal varies from transformer to transformer. Depending on your overall wiring scheme may complicate where to make the connection.
I am assuming all the line voltage connections to transformers, outlet strips, wall warts, etc. are not modified from from there out-of-box condition. So, getting a line voltage shock is not a concern.
If you have an outlet on the train table it should be connected to the house by a plug/outlet. If you hard wire to the house wiring you train table would be required to comply with the electrical codes.