Redditor u/p_giguere1 found out that iOS 12 can protect you against fake keyboards.
To trigger the warning: open a webpage in full-screen mode, for example a full-screen video on YouTube’s mobile website. Then tap several times at the bottom of the screen, as if you were typing on an invisible keyboard.
A warning message will appear telling you the website may be showing you a fake keyboard to trick you into disclosing personal or financial information.
I haven’t been able to trigger this, but the OP and a commenter shared screenshots that appear legitimate.
Check It Out: iOS 12 Protects You Against Fake Keyboards