So like X11 windows when using the original drawing API, buttons and other elements are just a window inside a window that receive events when they have focus.
Yes. One of the reasons why Wine is a thing is because the primitives provided by X11 map nicely onto those provided by Windows. No Wayland port of Wine is in the immediate offing, also for this reason.