High-energy cosmic-ray nuclei from high- and low-luminosity gamma-ray bursts and implications for multimessenger astronomy