Or smaller bees build smaller cells, queen lays same size larvae, but because of smaller cell the gestation period is shorter, thus smaller bees?
Nothing changes about the eggs the queen is laying. If you have bees raised in 5.1mm foundation, they are physically unable to build cells as small as 4.9. They can't turn in a small enough area. Bees raised on standard foundation will build cells down to 5.1 mm on foundationless frames. Once you have "regressed bees" which were raised in 4.9 mm comb, they will draw natural comb on foundationless frames. Natural comb is a mixture of small cells (down to maybe 4.6mm) and medium cells and large cells (for drones and honey). The bees will choose to use different parts of the brood comb at different seasons.
There have been reports that the gestation time in 4.9 mm cells is slightly shorter than the gestation time in 5.1 mm comb. This would be significant because varroa mites in worker comb are right at the edge of the time they require to complete one gestational cycle of their own. That's why the mites prefer drone cell.... because they have a gestation time of 24 days rather than 21 for workers. A small decrease in gestation time could possibly make a big difference for the mites. But at this time there still seems to be disagreement about the effect of cell size on gestation time for workers.