WW2 20mm HE rounds still relied upon direct hits to cause damage, yeah in theory their fragments could kill a nearby person but this class of weapon was still about hitting exceptionally close if not directly hitting people. Germany made great use of these weapons in various forms including a quad mounted AA system but there's no documentation that most of casualties from these weapons were from fragmentation.
If fragmentation wasn't doing much of the damage, why would they even bother using anything other than AP rounds, especially on the armored car mounted autocannons?
Also for living targets often a wound that doesn't kill often takes out someone from the fight for a time.
And they definitely weren't loading AP rounds for shooting at infantry.
But WW2 infantry aren't the giga-chad beefy humans in 40k, or Orkz, or Nids, and so on.
Edit: Also the German's typically didn't like firing HE against ground targets out of their 2cm weapons, they were primarily intended for AA usage.
And yet for some reason they put 20's on light tanks and armored cars that can't even aim at aircraft, how silly of them...
Silly Germans and French even did that after WW2 with their first IFVs...
en.wikipedia.org
en.wikipedia.org
en.wikipedia.org
On the other hand 40k giga-chad mooks tend to fight bunched up like a bunch of idiots begging to be shot at with small fragmenting rounds, oh, wait...
Tyranids, khornates or orks won't scatter to 10m loose skirmish line to limit losses from such.
Combine that with 40k explosives, materials and so on, not to mention bolts not being some cheapass ammo made for guardsmen, would definitely have better frag effects than a WW2 round of similar size.
These fragments are relatively small, and a significant fraction aren't going in the most ideal pattern. Additionally due to their non-uniform shape they will lose velocity very rapidly. This is also from a projectile larger than a bolt, potentially much larger depending on the exact bolt picture used for comparison.
Again, why do you assume that 40k Astartes can't get ammo with even a bit better design and materials than WW2 shells? One of the modern advances in frag weapons is the use of tungsten for significantly more effective fragments that take a longer distance to lose velocity... It's a bit pricey for us now, but hey, it's ammo for the Astartes.