I got the impression that Windows used to make APIs so that others could use the same UI elements as the OS in their programs. Have they stopped doing that?
Win32 was the one and only GUI framework. If you wrote your app for Windows, it would look like Windows. This was true for Windows NT, Windows 2000, and XP.
Then Office got the Ribbon UI but they decided not to let anyone else use it. Then Vista got the Windows Presentation Foundation (WPF), which was a lot like HTML, but used XML and had a more powerful styling+templating system. At one point they even tried to make JavaScript Windows applications a thing over a decade before it unfortunately did become a thing (Electron).
The problem is that WPF, like HTML, allowed nearly "anything". You could style any control any way that you wanted. So WPF apps looked somewhat... random.
Worse, it turned out that WPF was just too slow for applications, to the point that Microsoft themselves almost never used it. Instead, they used incompatible bits and pieces of it with C++ so that they could have something reasonably fast. But this wasn't WPF, and didn't look the same as user apps, and wasn't even internally consistent!
Now there are something like 10+ UI frameworks from Microsoft alone, not including third-party ones that can run on Windows.
This is why the Windows 11 interface is such a mess.