Context. Surveys of protoplanetary disks in star-forming regions of similar age revealed significant variations in average disk mass in some regions. For instance, disks in the Orion Nebular Cluster (ONC) and Corona Australis (CrA) are on average smaller than disks observed in Lupus, Taurus, Chamaeleon I, or Ophiuchus. Aims. In contrast to previous models that studied the truncation of disks at a late stage of their evolution, we investigate whether disks may already be born with systematically smaller disk sizes in more massive star-forming regions as a consequence of higher ionization rates. Methods. Assuming various cosmic-ray ionization rates, we computed the resistivities for ambipolar diffusion and Ohmic dissipation with a chemical network, and performed 2D nonideal magnetohydrodynamical protostellar collapse simulations. Results. A higher ionization rate leads to stronger magnetic braking, and hence to the formation of smaller disks. Accounting for recent findings that protostars act as forges of cosmic rays and considering only mild attenuation during the collapse phase, we show that a high average cosmic-ray ionization rate in star-forming regions such as the ONC or CrA can explain the detection of smaller disks in these regions. Conclusions. Our results show that on average, a higher ionization rate leads to the formation of smaller disks. Smaller disks in regions of similar age can therefore be the consequence of different levels of ionization, and may not exclusively be caused by disk truncation through external photoevaporation. We strongly encourage observations that allow measuring the cosmic-ray ionization degrees in different star-forming regions to test our hypothesis.