I built tracks for crashtest before. Both hydraulic and electric motors were possible to pull the car (...or the truck) to be crashed.
Hydraulic motors are indeed smaller at identical power and especially torque. Their speed and position can be regulated very well, though not as precisely as for electric motors. Price also was a bit lower because of the inverter.
A very distinct advantage for us was the ability to store energy in 300b nitrogen and release 1MW power or more to the hydraulic engine. Electric motors were only possible where the mains allowed such powers. Batteries can't compete.
As for actuators - that is, cylinder as compared to electric motor+spindle, the advantage was even clearer. The spindle could give a high force and even power in an acceptable volume, but by no way could it react as quickly as a valve +hydraulic cylinder does. We regulated 3MN (the weight of 2 locomotives) within 10ms with a few % precision: don't even dream of it with electric motors, alas.
The dark side of hydraulics is the fluid, so this is quite hopeless. It does leak often. It does require maintenance. It does fail. And it's dirty.