The type of input you're seeing is common on YubiKeys, where the USB HID keyboard emulation is used to send one-time passwords (the OTP mode of a YubiKey). This is because all modern operating systems have basic, built-in support for certain types of standard USB devices, and human-interface devices, like keyboards and mice, are one of those kinds. Thus, it's possible to support this mode on pretty much any device with a suitable USB port without the need for additional drivers. (However, it doesn't work with some keyboard layouts, such as Dvorak.)
On the other hand, the FIDO2 code generally needs additional driver and library support, and therefore isn't universally available. It is, however, more secure. Which mode to use depends on the security needs of a particular context.
There are definitely other FIDO2 fobs out there, such as the SoloKey. Its documentation doesn't reference supporting to OTP mode, so if you're really concerned, that may be an alternate option. If you just find the accidental typing option annoying, YubiKey provides the YubiKey Manager, which lets you turn it off.
Everything in security involves a threat model and tradeoffs. Personally, I find the risk of being compromised due to the YubiKey I personally bought being rogue to be very low. Shipping intentionally compromised fobs would likely put YubiCo out of business, and they seem to generally be a reputable actor. As a consequence, I am willing to use their fobs, believing them to be secure, and if the fob is secure, then the keyboard input functionality is not a concern. (I agree that accidentally triggering it is an annoyance, which is why I turn that off, though.)