Lego works the way it does because one company is responsible for producing every single little plastic brick. The Lego company takes great pains to control the precision of their manufacturing process to ensure the bricks click together. If you worked for Lego and you designed a piece that did not connect to any other pieces, they would not produce it. It seems obvious this approach cannot work over the whole world. However, I think if you look at software made only within a single company I feel like you do see this principle in action, frequently.
Also, Linux distros themselves are the domain-focused packages you want, all built around the "core" of the Linux kernel. There are various "distro building" projects that approach this configuration problem from varying levels of abstraction, e.g. Damn Small Linux, Ubuntu Builder, or NixOS.