If something bothers me with my phone's UI or if I want to change the behavior of some system service, I can do e.g. "apt source phosh", patch it and then "apt build-dep .", "dpkg-buildpackage -b" and "apt install" it right on the phone. I can even send the patch for upstreaming from there.
How easy it is to do an equivalent thing on Android?
UI-wise, termux can run Xorg and you can modify the interface you use there. You're right about services. Can't run systemd, but they can just run the service programs in the background (e.g. they can call sshd directly). Regarding modifying programs, maybe not that convenient directly on termux, but if it's rooted, you may be able to run docker and modify them in a debian environment.
The neat thing about non-Android phones with respect to what you mention is that you can do those things just like how you would on any other computer, without having to worry about Android workarounds that may one day stop working via an update.
"interface you use there" - yes, with a strong accent on "there". Sure, you can even run a x86 emulator in a browser and run anything you want there as long as it's performant enough, but that's a very different thing to actually controlling the OS you run - and even if you do happen to be in some control, modifying anything in Android without reflashing the entire thing is still a massive PITA. And of course you're not gonna pass the attestations once you assert the control anymore, so why not just ditch Android completely at that point?