It is relatively easy to replicate if you open 2 apps and start typing in the first one which opened, both on macOS and Windows (I don't use Linux enough to notice this issue).
A proper solution is probably faster startup times, but overall it pretty much never happens? Idk maybe I'm lucky or just conditioned to ignore it.