Most helmets now have a plastic skin over the foam which provides some structural integrity while the foam is being crushed [1]. But you are correct, the helmet only works because the kinetic energy is being absorbed by a material whose composition (closed cells) will naturally break apart into smaller pieces when enough kinetic energy is applied.