So you want to build your own window manager, or desktop environment?
This isn’t a trivial undertaking.
There is always the QT library, which has bindings for C++ and python. KDE/plasma is based on QT. LXQT and RazorQT are two other lightweight QT based desktop environments. I think they recently merged with each other though.
GTK is used by the GNOME Desktop Environment and Mate and I think cinnamon too. GTK has C and C++ bindings.
Alternatively, there is dwm - a tiling window manager which is approximately 2000 lines of C code - which implements a minimalist, but complete window managerthat you can heavily modify if you like. There are a number of pre-made patches available that implement various new features. Or you can edit the source code yourself to make any other changes.
dwm has very few external dependencies. Can be built and installed from source in mere seconds.
There are a number of other similar tiling window managers, written in various languages like i3, awesome, xmonad.
Again, pre built packages are available, but they can easily be built and installed from source too- allowing you to make any modifications to them if you want to add (or remove) certain features!