Identifying elements using id - id changes on each load - GltfLoader

I have an use case where I’m modifying GltfLoader.js to give me only the scene, node, mesh, accessor objects to generate the tree first and then I’m loading the glb fully at a second time to display the model in viewer.
To match/identify elements from the tree in the viewer, i need to do a getObjectById(), but it seems during the second loading, the 'id’s of elements seems to have changed. Is this the GltfLoader’s usual behaviour? Is there a way to retain the ids or is there a much better way to identify the elements?
I cant use getObjectByName because my use case supports duplicate elements.
Is providing userData for each element, having my own id’ing a good solution?

Yes, I would recommend this workflow.

Normally, it’s best to provide a name for your nodes but as you said this might not work for all use cases. The id property in three.js is unrelated to glTF and can vary depending on the order of 3D object creation. This is usually not something that you have in your control (because of asynchrony) so it’s best to work with a custom identifier.