Most of the ports up and down the West Coast are at or beyond capacity, yes.
But I don't think that the ability or lack there of to move rail cars in and out of them is the problem. At least, it isn't in the Canadian ports as per my experience. Both Prince Rupert and Vancouver are undergoing programs to expand their daily container capacity, but most of that capacity is focused on getting more dock wall and crane capacity, versus rail capacity. In fact, to the best of my knowledge there is no plan to increase the railway capacity into Deltaport (as an example) as there is already enough there to handle the 3 railways that service it, along with the hundreds of trucks that enter and exit every day.
I think that the bigger issue is with the facilities in the interior of the continent. Take CN's Brampton Intermodal Terminal for instance - the facility, as it currently sits, is designed to handle about 2400 containers per day. It averages almost double that - thus the requirement to build another facility for the GTA. CP's Vaughan Terminal was built much bigger and so isn't in danger of being so overcapacity, but that's also a function of how agressive CN has been on capturing that business for the past 20 years - CP has a lot of catching up to do (and in fact, in the past 5 years, they have started to claw back some of that business).
The mainline capacity constraints are there, but they aren't insurmountable or problematic - yet. There are much more serious constraints when dealing with VIA Rail and the Canadian, but that's due to the mixing of very different kinds of trains with very different performance abilities. In large part, a lot of the freight trains are operating in very similar manners and with similar performance figures, and so putting them all together isn't a big deal. And in the case of CN, they've optimized this even futher by operating multiple high-priority trains in one direction together as a fleet.
But ultimately - could the railways handle 20% of Panama's current container traffic? I think so, yes. On the whole, they're already handling a very large proportion of the container traffic headed from places like China, Indonesia and Japan to places on the East Coast.
Of course, all of this has been about containers specifically. Bulk cargo is a whole different ball of wax, and much, much harder to handle as a transload. And I don't think that the ports on either side of the continent are particularly well suited to dealing with it.
Dan