command + tab not switching focus
Switching spaces using the keyboard shortcuts is dependent on your focus, rather than the app that's in the foreground. macOS determines your focus by looking at your mouse's position.

If it used the foreground app to determine your focus, and you had a space with no apps open in it, you would never be able to use a keyboard shortcut to change the space on that monitor.