That's... what a hypervisor is.
Generalizing massively, a simple hypervisor runs a small amount of code at boot to setup its own state somewhere, and injects its interrupt handlers into various places in the system, and finally chain boots the real OS. When the real OS tries to communicate with the underlying hardware, the hypervisor interrupt is triggered and it does it's stuff.
With modern virtualization acceleration, the hypervisor can enable and handle interrupts for an even wider range of events that it might need in order to efficiently interpose the OS.
A more full-featured hypervisor may start to look like a mini-OS with its own scheduler, etc. But a simple hypervisor is basically like an old DOS Terminate-and-Stay-Resident executable.