If the teensy loader is ignoring the PlatformIO --upload-port option, is that an issue with the teensy loader or with PlatformIO?
I'm reluctant to comment too deeply about PlatformIO, since I don't personally use it. But if you try that other approach with teensy_post_compile and teensy_ports, I believe you can see we're using a very different convention to specify ports. The port names Teensy's tools expect are based on the physical USB port on your computer (and its hubs). PlatformIO seems to be using the serial port names as defined by the operating system.
In Teensyduino 1.41 and older, we used to use the serial port names. The main downside to the serial port names is Teensy supports many USB modes where there is no serial port at all. Teensy's bootloader mode also uses no serial port, it's 100% HID protocol. In those old versions, the software was forced to resort to guessing if you had more than 1 Teensy connected, or if you changed the Tools > USB Type setting in Arduino. A secondary problem happens in Windows and Linux, where a different COM port or serial device name is sometimes assigned by the operating system. Linux is particularly problematic if you have multiple boards and you switch USB Type settings, because it reassigns the serial port name each time Teensy reboots. If some non-Arduino software holds the port open, things get even more mixed up on Linux.
Starting with Teensyduino 1.42, we switched to using port names which represent the USB controller, chain of USB hubs, and the physical USB port. This solves all of the problems I just mentioned. If Linux assigns a different port name, we still access the same physical device because we're now finding it based on the Linux sysfs name which represents the physical location. Likewise on MacOS and Windows, we're using names which encode the physical location, so we can have a highly consistent way on all 3 systems of referencing the actual Teensy you selected, even as is changes from Serial to HID in bootloader mode to perhaps something like MIDI if you upload a program which isn't USB serial.
This is possible on Arduino because of a feature called Pluggable Discovery, which actually began as code I developed to enable 1.42's physical ports. That code was contributed to Arduino. Cristian Maglie (Arduino's lead developer at the time) rewrote much of the code, but the concept is the same. A platform like Teensy can provide its own tools to discover which devices are connected, and the tools to actually use the devices. In this mode, the Arduino IDE doesn't care what the port names actually mean. It just uses the Teensy-provided tools to communicate, referencing those arbitrary port names it received from the discovery tool.
Again, I'm not an expert on PlatformIO, but my limited understanding is it does not yet have anything nearly as flexible as Arduino's Pluggable Discovery. Every indication I see is PlatformIO requires port names which actually are COM ports or serial devices. That's a poor fit with Teensy since we use HID protocol in bootloader mode and support many non-Serial protocols (can those even be used at all from PlatformIO??) It's also a pretty awkward interface between PlatformIO which expects port names to be serial devices and Teensy's tools which revolve around very different port names which specify physical USB ports.
Until PlatformIO gets a more flexible way like Pluggable Discovery, I do not believe there is any easy solution that will give a very reliable way. The cold hard reality is the old "everything must be a serial port" paradigm has never worked well for Teensy's use of many different USB protocols. That's why so much work went into Teensyduino 1.42 and contributing Pluggable Discover to Arduino.
Even now with Teensyduino 1.53, the tools for Teensy still support a long legacy of the guesswork approach we always had to use before the switch to physical port names in Teensyduino 1.42. It's very unlikely I'll ever remove all that ancient code from the tools, even though we don't really use it anymore, because other systems are still based on OS serial ports. But the caveat is that "everything must be serial" approach just can't ever be reliably precise for hardware like Teensy which dynamically changes from Serial to HID to MIDI, Audio, and other stuff (and more protocols likely to come in the future).