Remapping Esc and CapsLock

Hi, I want to configure keyboard in such a way as to swap Esc and CapsLock.
There is a checkbox for that in the Advanced tab in Keyboard Settings (KDE).
I’ve been using CapsLock to switch my keyboard layout before, so I expected to use Esc (the physical key) now, that I’ve swapped them.
But now CapsLock key does work as Escape, while Esc key doesn’t switch layout, despite me having the “Switching to another layout/Caps Lock” setting enabled (in the Advanced tab of the Keyboard Settings), it locks Caps :frowning:

Is there a way to make this work?