That is my impression of the Arduino codebase as well. I think the goals of the project are to say "yes" to every contribution, and to pretend that a sketch can work on every Arduino-compatible piece of hardware.

For amateurs, this is all fine. You don't care if the code is good, because you're just making a $60 555 timer. And you want your sketch to work when Adafruit sends you a new MCU in your monthly hacking box or whatever. So Arduino does very well there, because that's what users want.

Over in the real world, you pick a board and use that for the lifetime of your project. Going through 8 abstraction layers so you can run your code developed against an ARM M4 on an ATMEGA32U4 is not something anyone cares
about.

What people do care about is developer productivity, and the Arudino toolchain is just terrible. I'm not talking about the IDE, which is what it is, but the actual mechanics of building and flashing devices. I have a Windows workstation, and the % chance of being able to successfully flash a sketch is about 50%. Sometimes the device switches ports and this confuses the IDE greatly. Sometimes the device just doesn't show up properly. Maybe this is all Windows' fault, I don't know, but I have the exact same problems on Linux. Meanwhile, the same board in UF2 mode works perfectly every time. I can edit Python code against a file sitting on the device, or run "tinygo flash" with a 100% success rate. What am I even getting from Arduino if I can't edit or try my code efficiently? I don't know where it all went wrong, but the arduino-cli manages to be just as flaky, so I think it's just systemic. You glue together an abstraction layer and 1000 flaky vendor-provided tools... and the result is flaky.

I think hobbyists tolerate it because they are told that hardware is "hard" (it's right there in the name), so they are perfectly happy to chant magic incantations because they don't know right from wrong. But if you've written software before, you know this is wrong. All the toolchain needs to do is translate C++ to machine code, which I know from writing C++ that can all work quite well. Then the toolchain needs to copy that machine code into Flash memory on the device, and tell the MCU to restart. I know this works quite well too because I've used UF2 programmers and it works every time. Finally, you need to make a virtual serial port to support debugging. My tinygo programs successfully send serial output to my computer 100% of the time. Arduino IDE? 50% on a very lucky day. Mostly I click around hopelessly, crawl around on the floor trying to plug and replug USB devices, press the reset button on the MCU 700 times... and then 30 minutes later I can see my debugging output. What was I working on again? I forget.

Anyway, I suppose that none of this is unique to Arduino. I've used Atmel Studio, I've used Nordic's NRF52 dev kit, I've used avr-gcc and teensy-cli... all are bad in their own way, but they do consistently work and don't get in my way. Arduino consistently gets in my way by not doing the basics right consistently. All so my code can run on devices that I don't have. It's not worth it. I am not sure how this appeals to pros. They should hire some actual software engineers and check back in in a year. I'd be happy to try Arduino again.