I compiled the short sketch below with Optimize: Debug and no USB serial port is created under Windows or Linux. It works when using any other Optimize setting, and works with Teensy 3.5 compiled Debug.

Teensy 4.0 and 4.1
Arduino 1.8.13
Teensyduino 1.52 and 1.53
Windows 10, Ubuntu

Code:
void setup() {
  Serial.begin(115200);
  while (!Serial);

  Serial.println("Hello world");
}

void loop() {
}