Build systems have historically favored declarative configuration over programmability. See Makefiles for an example.
I’m not saying that’s necessarily the right approach, but it does seem like declarative configuration is a natural way to define a build system.
That said, I wholeheartedly agree there is much room for improvement with webpack.