a few reasons for compact size are related to the development of surface mount devices taking up a lot less room for the preamp section. in general, PCB manufacturing has come a long way. the transistors used for amplification can be cheap or expensive. it's just a factor of getting voltage high enough and being able to source enough current. power supply designs have helped greatly with efficiency.
now, what most ignore is what distortion they make 4kW at - 10% is common for those kind of amps. there is a HUGE difference between 4kW at 10% THD vs 0.1% THD which is what the old school amps aimed for. also, it's common for amp manufacturers to list THD as a separate spec from power output ratings. so they can say THD is 0.3% but that may be at just 1/4 of the rated power output. plenty of tricks they can use while being honest. they just don't tell you what the conditions were for their rating.
car audio manufacturers have no standards to comply with. if they make 4kW for 1 second at 50% THD just before it bursts into flames, they can print that number. many power ratings lack supply voltage, THD, but all of them lack the time duration the amp is able to sustain that rating.
amps with huge footprints can use many less expensive output transistors instead of fewer more expensive transistors.