Probing the gauge symmetry breaking of the early universe in 3-3-1 models and beyond by gravitational waves