The abstraction is done directly into the core of the engine. In the class /core/os/os.h, there is a virtual function called "initialized". This class is actually extended by any os_*.cpp class (in each platform directory) and an OpenGL Context is created in this specific function. This is then into that function that you should look to know how the window is created as it is required in order to create an OpenGl Context (you will probably need to get your hand on the OpenGL documentation to be able to read those parts though).
For how Godot know which os class it has to use, it is actually injected, but I don't know when. Probably at compilation time, but it is also possible that it is at runtime, using a factory pattern (less likely as it would be less performant, and the game would be heavier, but I am not an engine dev).