The Mining and Energy Union says rail workers were left “shaken” and narrowly escaped harm when the train they were repairing was struck by another in Western Australia’s Pilbara region.