The car analogy works for some things, but not that well for this.
There are many layers of software in a computer (or smartphone). Far too many to explain in a post. But keyboards might be possible.
A keyboard connects to a computer in a way that's most easily modelled by a network connection. The keyboard has a small logic chip that "knows" a protocol (mostly USB these days), and can announce itself as a keyboard.
Each key generates a unique code that's carried to the system over this protocol.
There's a layer of hardware stuff that's out of scope, then a very low level program will be started and will begin reading the keycodes off the "inner side" of the USB layer. These are sometimes called "drive(r) routines" and similar names. They're not supposed to miss any data from the external device (our Keyboard in this case). This is easy with Keyboards, which are very slow. Mice send many more signals (fewer unique codes though).
Drivers have no idea which program "owns" the keyboard at the moment. That's part of what the main operating system handles (program start/stop and context switching, memory management, for Windows run the "Desktop" GUI, ... and interaction with the hardware layers via variations on "drive routines").
At this point there's a lower level of the operating system that can do whatever it wants to with incoming signals and data (keyboard key pressed, mouse moved, block of data from a disk delivered, etc).
It makes sense for there to be a few interrupts that can get through all the applications and do things to:
* The hardware (e.g. CNTL-ALT-DEL, and at least one weird sequence to get to the "BIOS"( which is part of the H/W, not the operating system)).
* The operating system, "behind the back" of whatever application has priority in the higher levels of program management
The last one is what this question is about.
If you had no way to stop a program, or switch to another one, an application could take over the system, safe from anything except some autonomic OS interaction or the box's power switch. This does happen occasionally, and can be a rage-inducing experience
So the operating system provides ways to tell it to do something that overrides the active application in small ways. Such as switch to a different program.
Some of them are keyboard codes. The OS does this by making a decision right at the "inner side" of the K/B drive routine - some keycodes aren't available to normal applications, because the OS grabs them for its own purposes.
But ....
... this is implemented by a low-level API in the OS. Something normal coders can't always get it, depending on the coding stack (e.g. AFAIK standard Java can't do this, though Java can call C code that can).
But it's still just an API, and people who know what to do with it can hook some of these special keycode interrupts themselves.
Many game coders have the necessary skills and toolkit. Not all game coders, but any "big" game will have access to such people.
I'm not interested in the smaller details of this, but it's certainly true that the OS
could reserve some special keycodes to itself (i.e. not readily available to even technical coders).
But the question proves that Alt-Tab can be "taken away" from the OS by a user program.. This isn't
necessarily a bad thing, but that's another discussion.
It's certainly the case that some applications react badly to being suspended by something external to the program, and instead want to save their internal state before they give up control. A multi-player RTS is an example of a candidate for this, but I don't know for sure.
BTW there's always a tech fix to resolve such an issue, but if it's crazy expensive compared to its value, it won't be used.
PS: Windows and Linux are very different.
Windows is very bloated in comparison - the Desktop being closely integrated with the OS is an example of the mixed +/- effects of that. And also an area I mostly avoided here because it would require a bunch of mostly irrelevant extra text and/or things I don't understand well enough to explain clearly (or at all
So a principle: if you have finite time or energy to talk about how IT stuff actually works, there are
always layers above
and below what's actually discussed. Even PCs, game consoles, and smartphones are
very complex.