This is a very interesting topic, because its thorny.
Is it possible your MIDI device is qualifying as a “USB MIDI Class Device” and thus using the class driver, but “falling over” somehow during the enumeration, until finally the manufacturer-provided driver is enumerated for the device, and ‘eventually’ provides the appropriate device endpoints?
Could it be a composite device? [0]
USB MIDI devices often fit in one of two different catetgories - two-stage loader, or single-stage.
A two-stage loader is usually used in the case where the device itself doesn’t have any static RAM or EEPROM, and thus needs to have its ‘real’ firmware loaded, in the first stage, as a binary blob from a manufacturer-provided driver - only then (once the binary blob is loaded and the device reboots to run it) - is the Microsoft-provided internal class driver instantiated for the running device.
(A single-stage driver doesn’t do this because the device has EEPROM/sram and can thus just boot straight to a firmware which gets recognized as a class-compliant device, and the OS thus uses the class driver to provide that device to applications)
More details about the devices in your situation would prove useful - also, have you tested this on every single USB port in the buggy system? Its quite possible, also, that POWER requirements are not being fulfilled on one of the systems ports - i.e. the port starts up in low-power mode, the device is connected to it, the driver determines that the device needs hi-power, but - for some reason known only to the Microsoft gods - the USB port itself takes a while to switch from lo- to hi- power mode. Another factor occurs when you’ve got a USB HUB connected to one of these misbehaving lo-/hi- power USB ports, and there is a dizzying storm of enumeration going on before the PC USB port and the HUB USB port finally settle on the correct power requirements for the MIDI Device you’ve plugged in.
Chase down and install the “USBVIEW.EXE” application from Microsofts Windows SDK for your system [1] - this can be used to show you when seemingly-random enumerations on the USB bus are occurring, and can provide you some clues about things. It may be that USBVIEW.EXE will show you that the port you’ve plugged into has a power-draw problem, then a few seconds later a second-stage of the firmware loader resets that port into hi- power mode, and then - even more complexity - maybe the device itself resets because it doesn’t get the power it needs.
This, by the way, can then also be magnified in terms of complexity yet again, if the device is also a composite device…
USB is ass. Just sayin’.
[0] - Descriptors on USB Composite Devices - Windows drivers | Microsoft Learn
[1] - Universal Serial Bus Viewer in Windows - Windows drivers | Microsoft Learn