The short and simple answer is no, it's not possible to change the USB Type at runtime.
The long and complicated answer is also mostly no, but with explanation of the obstacles and what problems you would have to deal with if you overcame those obstacles.
The main obstacle is the way USB enumeration works. When the USB host (or a USB hub the host controls) detects connection of a new device, the host goes through a process called "enumeration" where it learns of the USB device's capabilities. The main reason you can't change the device (Teensy) USB Type at runtime is the USB host only does this enumeration process once, shortly after it detects the device has connected.
You could write code which turns off the USB port. After some time (should be 10ms by the USB spec, though some hubs might take longer) the host will detect Teensy has disconnected. To the host (your PC) it is the same as if the USB cable had been physically unplugged. This happens every time you upload new code. It certainly is possible to do under software control. But you can't make it "seamless". On your PC, the situation is the same as if you unplugged the hardware and then quickly plugged in different hardware.
Even just doing that won't be easy, because none of the code is designed and tested to do it. Turning off the USB hardware is involves just writing to a couple hardware registers. Modern systems should handle it well. Older versions of Windows could crash if you do this in the middle of a control transfer, which is the reason Teensy's USB code has a software timer. Re-initializing the USB hardware is also another path that never gets any testing, because it simply never happens.
If you do get the USB disconnect and reconnect working, the final obstacle is the software design is for just a single USB Type defined at compile time. All the code for every type exists, surrounded by #ifdef checks. You'll need to replace some of those with runtime checks rather than at compile time. The first part is just answering the requests for device descriptors differently at runtime. Then the USB host will try to communicate with the interfaces / endpoints you told it. That may actually be simpler if the 2 modes you want are similar like going from dual serial to triple serial. You could have have the triple serial code compiled and the USB host won't try to communicate with the 3rd serial interface if you told it only 2 exist. Obviously if you tried something more complex where the descriptors tell the host a very different set of endpoints / interfaces exist, then you'd need more runtime tests.
So that's the long and complicated answer. If you're willing to live with the required disconnect to change modes (Windows will assign different COM ports, user level programs which don't handle USB disconnect will need to restart, etc), and you can dive into the USB device code to make these sorts of structural changes, it could be done. But the disconnect behavior is a pretty big caveat. It won't ever be a seamless experience.