Probing the cores of subdwarf B stars: how they compare to cores in helium core-burning red giants