There's no real reason why Apple can't build a "development sandbox" app that emulates a terminal (that has no access to anything on the iPad outside the sandbox app) that includes a terminal, a package manager (possibly acquiring Homebrew to help them make it happen), possibly a wrapping GUI to manage secrets, IDE-style text editor, etc.
I'm not really sure why nobody's built one yet except for the sheer complexity involved. But it certainly seems doable.