You know how in the Unix shell, you can have programs and they can talk to each other through pipelines, env vars, and command line args, right?
Emacs is a similar environment, although its functions can compose in even more ways. Not only that, the ways they can compose is itself extensible, so over the years people have invented “hooks” and “advice” and “macros” and more. It’s a mess is what it is, but it’s a very flexible mess.
It has a ton of stuff already, including being able to run Unix shell functions, so it can do a superset of what a normal shell can do.