it automatically changes COM port, seems bizarre to me.
Windows tries to associate a unique COM port number with each USB serial device you own. They're assigned in the order you plug them in. If you and your friend own the same 3 devices, and you plug device A in first, it becomes COM3 on your PC. Then if you plug in device B, it becomes COM4, and device C becomes COM5. The idea is if you unplug then all then reconnect 1 or more, say device C only, it (should) always show up as COM5.
If your friend with the same 3 devices plugs in device C first, it becomes COM3 on their machine. That association between the USB descriptor info which uniquely identifies that particular device and which COM port it always gets assigned is stored in your local Windows Registry.
You might expect Teensy would always get the same COM port number. And it should, on the same PC with the same Windows Registry info, but only when all the USB identification remains identical. If you change Tools > USB Type to cause Teensy to implement a different set of interfaces, or if you edit usb_desc.h & usb_desc.c, as far as Windows can tell you have just plugged in a completely different USB device. Windows can't know it's physically the same Teensy, and it most certainly should not guess any such thing. The USB descriptor info says it is now something else. As far as Windows knows, you've just bought a completely different USB product.
Sadly, this process isn't flawless. I don't know if it's bugs in Windows or something gets corrupted in the Windows Registry, or a result of changes made to other devices causing conflicts, but we have occasionally seen cases where Windows gets rather confused about COM port number assignments. But those are the exception where things go wrong.
Windows is indeed supposed to assign a new COM port number when it sees a new unique USB device. When you change USB types or edit the descriptors, to Windows it's a completely different USB device.