Modern motors get lighter in part because they can offer lower torque with a smaller rotor but compensate with higher rpm. That’s not possible for a hub motor
Pretty much all top Formula Student cars now use hub motors. Mainly for packaging reasons. Putting the motor in the unused space in the wheel means you can make a smaller chassis and have more space for wings and underbody aero.
And why you cannot have small hub motor with high voltage (kilovolts) and very high rpm?
It will still make high power at high RPMs, but you have to gear it down to convert that power into more torque at low speeds. A gearbox makes it not really a Hub Motor at all any more. Terminology aside, a gearbox also adds even more weight and complexity inside the wheel. For less weight and complexity you can use a half-shaft to the center of the vehicle and use whatever motor you want inboard.