If you know ahead of time that the built-in keyboard is broken, and this should not happen in a working phone, then there must be a reason for this flaw.
As paranoid as I am, I wouldn't trust any keyboard on your phone. How long have you been using it, and what applications do you install besides a third-party keyboard? It's also important to consider which links you click on.
Alternatively, in the absence of other methods, such as a separate device, reset the phone to factory settings. But also keep in mind that some viruses remain even after recovery. Such viruses are usually installed in the recovery partition and are not removed in any way. Also, the virus may remain on your MicroSD.
And finally, you can try to flash the phone yourself.
Not like the broken you referring to, the keyboard that comes with my smartphone is very sluggish, and it's very noticeable when I am typing fast, it not as if it's not working.