macOS keyboard layout switch bug
I had the same problem. As I understand it, this is intentional behavior by Apple (they've been known to have additional delay on Caps Lock key to prevent accidental presses). Not many people notice this because it happens only when you type really fast (to reproduce just try spamming one key and press Caps Lock to switch the language at the same time – sometimes it would just be ignored).

There's a way to solve this – use Karabiner Elements. You can find how to set it up here: https://hybridtechcar.com/2018/07/01/turn-caps-lock-into-a-super-button-suitable-for-any-macbook/