I would say that something is music if it's conceived to play a series of sounds that are meant to pass on a feeling.
Gamelan might be both or something in between - performing a ceremony but also seeking to instill a feeling that makes someone immerse in the spirit of that ceremony.
It's important to note that we shouldn't simply take Wikipedia or Western books as reliable sources for defining what other cultures' practices mean _to them_. To us it might sound like music, but maybe to them it was supposed to be something that doesn't have an equivalent in our culture. So we translate that as both 'music' and 'ceremony'. But for them maybe those are not separate things.
And the way music was conceived in our culture to be recorded, written, replicable, and enjoyed to reflect a mood, a feeling, might not be what we find in other cultures.