Throughout our known history of geometry were the units representing areas and volumes always in terms of squares and cubes respectively?
No. Take a look at the Japanese units of area. The base unit is the tsubo, which is based on the size of tatami mats, and which thus has no direct relationship to the lengths of the sides. The unit itself is not easily expressible in terms of length units being multiplied together, and this idea was exported to Japan, not an idea that the Japanese discovered on their own.
Take ancient Egyptian formulas as an example, the fact that their formulas are very close to ours must mean that the units representing areas and volumes were also unit squares and unit cubes, correct? I mean we can safely stamp their formulas with for example cm and cm2 and get the same result.
I am not sure I understand this question. But dimensionalized formulae and nondimensionalized formulae tend to look differently. And while Egyptian units for area and volumes may look similar to hours, this is by no means true for every ancient civilization.
And does that mean we can safely assume that they didn't measure e.g. volume by counting the number of times you can fill up an object by throwing identical fistfuls of sand into it?
Take a look at the Japanese units for volume. For a very long time, the base unit was the koku. 1 koku is equivalent to the volume of rice needed to feed a person for an entire year, and the economy of ancient Japan was even based on this unit of volume: in fact, the koku served not only as a unit of volume, but effectively, as a unit of currency. This is not quite "throwing identical fistfuls of sand into a sack", but it comes quite close. Anyway, the point is that this unit of volume has nothing to do with the side lengths of cubes or rectangular prisms. The relationship between the koku and the Japanese unit of lengths is even more non-existing than the relationship between that of the tsubo and the Japanese units of length.
What I'm saying is basically this: If the formulas from ancient times are the same as ours (say for rectangle area as length × width) then that must mean that their unit for measuring area must have also been in the shape of a square and equal to 1×1 of whatever their units of length were?
I just provided a counterexample of this.