Could we instead extract the useful bits from the sysfs path, like USB port numbers and put them into some of the GUID data fields?
Probably. Question is what are the useful bits for any given subsystem though. My thinking is that by hashing the entire path we side step the issue of sysfs paths sometimes not being well defined and also get easier to reason code as we don't need to care how to deconstruct the path, nor how the GUID specifically is calculated. I am fine with doing it differently as well though.
Microsoft also documents the container id as globally unique, so we need some degree of smartness here IMHO.
I don't think we need to have anything stable across hotplugs or prefix restart.
From observing windows it seems the containerid is stable there, so conceivably an application could store the id persistently somewhere. Granted, bit of a stretch.
BTW !359 is implemented in devenum as clsid_blob (and read/write thereof) https://gitlab.winehq.org/wine/wine/-/merge_requests/7238/diffs I think