I probably misunderstand what you mean. To me, that sounds like things that device drivers do.
Yes, in DOS, because you needed a way for the TSR program to be kept "in-the-loop" about events happening in the OS. Like the most common DOS TSR's would be activated by a key press. It somehow has to see all the key press interrupts go by.
For Windows, there is a distinction between a device driver, a filter, and a Windows Service. A device driver is often at the lowest levels -- some still running in kernel mode despite all of Microsoft's efforts to push drivers to run in user mode -- and talk to the devices directly. For the kernel mode drivers, interrupts are sent to them directly. For user mode drivers, the OS provides a thunking layer where the interrupt goes to the OS in kernel mode, and then the OS routes the messages to the user mode side. Filters can examine the stream of data and commands going to and from the devices and the OS. A Windows service need not necessarily be a device driver -- it can be using the same user mode APIs that normally use a application developers. Yes, there are services that work intimately with device drivers and filters, but a service need not be tied to servicing device needs. Consider these Windows services that typically run a desktop and/or server: Windows logon, Windows Update, Google Update, Windows Installer, Task Scheduler, Print Spooler (as opposed to print drivers), font cache, SQL, IIS, FTP, SMTP, ASP.NET State Service, background intelligent transfer service.
How to write a Windows Service using the traditional .NET Framework way:
In this tutorial, create a Windows service app in Visual Studio that writes messages to an event log. Add features, set status, add installers, and more.
learn.microsoft.com
And the newer .NET (Core) way:
Learn how to create a Windows Service using the BackgroundService in .NET.
learn.microsoft.com