The reason is that as you charge the battery, the anodes grow and distort as the lithium ions carry charge to them from the cathode. Extreme charges appear to damage the physical structure, reducing charge capacity for future charges. Shallow charges result in less physical distortion, and thus less damage. (Video)
My previous laptop had a battery-saving feature which stopped charging at 80%. I turned it on within a few weeks of buying the laptop. I also almost never discharged the battery to 0%. When I bought the laptop, the battery would last about 2h 45m. When I replaced it 5 years later after probably 1000 cycles, the battery still lasted 2h 30m. So shallow charges and not putting the battery near the extremes works.
Please note that a lot of the newer laptop batteries seem to have this functionality built in. If you look at the "battery health" stat with a tool like HWINFO or HWMonitor when the laptop is new, the battery will already show about 5%-10% wear. I believe that's how manufacturers are tricking Windows into not charging the battery too much - falsely reporting the battery's current capacity as less than its actual capacity.