kestrel is small event driven web server library. it communicates to AspNetCore modules via HttpContext. There is also a simple library called IISHttpServer that can be used instead of kestrel to communicate via HttpContext.
if you run the asp.net application from the command line (or process.start), the startup code calls the kestrel library to be the web server. this is called self-hosted, because the standalone app is a webserver.
if you use the AspNetCore module to host, it loads the app as a dll, and app startup uses IISHttpServer instead of kestrel as the source of the HttpContext messages.
so, the app code only knows about HttpContext. You can build you own app, and host asp.net app code, and use any transport you want. An example of this is hosting asp.net in electron, where there is no webserver.
better explanation:
https://weblog.west-wind.com/posts/2019/Mar/16/ASPNET-Core-Hosting-on-IIS-with-ASPNET-Core-22