You are interested in the density field of an object which is a scalar valued (just a number) function over 3 dimensional region of space (shape of the object under study).
Your wish is to study this function using just 2 forms of interactions - mechanics and gravity in most simple form without destroying object.
I agree that we need to try to understand this question from very general point of view first.
Mechanics and gravity exhibit properties of superposition - which means that properties of objects spread over space are substituted with point-like properties (one example you already gave - gravitational field of a sphere does not depend on its radial density distribution - so function of density distribution is substituted with just one number of total mass).
Hence using just gravity (without scanning inside with a waves - which for gravity waves is impossible at the moment) gives a negative answer - not possible.
Same is true for mechanics because mechanics also reduces 3 dimensional distributions to point-like ones.
But! The funny part is that THAT is why mechanics and gravity are so successful theories because they allow us to abstract from inner properties of objects and reduce dynamics to only global properties.
Logically it is also clear that to know 3 dimensional distribution you need to offer algorithm which will give you that amount of information, and this information can only be obtained by means of physical interaction with each point inside of object or observation of waves emitted from each point.
Finally you already gave counterexample to your goal - the radially not uniform sphere. There is no way to find out this distribution using just mechanics and gravity without destroying it or using waves.
You send the box and liquid towards a barrier equipped with a gauge to measure force. The setup looks like:
When the box hits the barrier it stops, but the liquid inside it keeps moving. A short time later the liquid hits the side of the box and it too stops moving. So when you record the force at the barrier as a function of time you will get two peaks, first as the box hits the barrier and stops, then a short time later a second peak as the water hits the end of the box and stops.
If you integrate the force time curve you will get the impulse during the collision, and this is equal to the change of momentum. Since momentum is $mv$, and you know the velocity $v$, you can calculate the mass. The two peaks will give you the mass of the box and the mass of the liquid.
Needless to say, in real life you will get only approximate results. The peak for the box should be clear, however the viscosity of the liquid will mean there is a force exerted on the barrier while the liquid is moving and before it hits the end of the box. Also the liquid will splash, so the impulse you measure will be too high. However the method should give you an approximate result.
Best Answer
Get someone to relax their neck as much as possible, stabilize their torso, then punch them in the head with a calibrated fist and measure the initial acceleration. Apply $\vec F=m \vec a$.