I imagine load distribution, box fullness, rigidity etc can be included as dimensions to optimise. It'd be necessary, really, but doesn't make things any easier.
This is, however, what I believe Amazon are trying to achieve. As you point out, they have the advantage of knowing in advance what the different items being packaged are. They can presumably optimise within a single box, over a single order and across multiple orders and shipments. At their scale it would make sense to devote a large amount of compute to squeezing a few percent extra out of each cargo flight and truck delivery.
The difficulty is to build a machine that can physically put the parcels into the truck.
Elsewhere I complain that software folks think they're smarter than everyone else. And here I am proving it :)
Loading semis is basically 3D Tetris where you have to consider not only shape (boxes, tubes, cylinders, and everything in between) and size (fits in the palm of your hand up to 2- 3m long), but weight (basically 0-75 kg) and rigidity. Humans pretty easily develop and intuition for these things. I certainly unloaded plenty of semis that were for all intents packed to capacity. In theory you could probably have some kind of fully integrated system that let you know ahead of time the details of every package so you could model the entire load and figure out how to fit it... but doing what humans do loading on the fly would be damned hard.
Loading package cars (the brown delivery trucks) drops the need to maximize volume carried and adds constraints about the order and location of packages so the driver can find them. Again though, it’s a fairly loose system. In theory the load is pretty well distributed across the truck’s numbered shelves by the planning system... except all the days that it isn’t. A loader ends up making a lot of on the fly calls to overflow shelves and rearrange things so they fit on the truck and the driver has a reasonable chance to find them.
tl;dr - Anything is possible, but automating that part of the process is an enormous challenge IMO.