Are you saying you wouldn't be concerned if you found one of these on your computer? https://www.keelog.com/
In any case, both hardware and software keyloggers exist which would be thwarted by an onscreen keyboard. If I recall correctly, mouse keyboards became popular when keyloggers started being more known, and the following generation of malware took screenshots every time you clicked.
It’s a very obsolete security measure but did make sense briefly.