I was trying to understand the intricate and hidden structure of the internal sources and libraries developed with Arduino, and the truth is that I found it quite complex. It is one of the things that I have never liked about Arduino, in addition to its terrible and basic IDE, all the things that are hidden
I don't understand what you're talking about.
The Arduino build process is trivial (to the point of being annoying) and pretty transparent and obvious. Much more obvious than the
average auto-generated template-based Makefile, for instance.
If you turn on "Verbose" compilation in the Arduino IDE preferences, the build window will show every compilation-related command that happens. Aside from the pre-processing of the user sketch itself, which is "not much", you just have a chain of standard gcc tool usage.
I copy&paste compile/etc commands from the IDE to a CLI shell all the time to add/adjust some parameter that isn't changeable from within the IDE.
In addition, there's a well-documented "3rd party board" description explaining the "patterns" used for creating the compile commands, AND the whole mess of stuff (IDE, cores, libraries, etc) is all Open Source...