Prevent battery from overheating
All phones automatically stop charging once they reach 100%. They then carefully monitor and "bounce" the battery level to ensure it doesn't drain too much, but doesn't overcharge, either. But they're definitely designed with this core concept in mind to reduce damage. Besides, if it stopped charging it at 100% and didn't start back up again, odds are by the time you woke up you'd need to start charging again to get back the 20-30% you lost, which is another charge cycle, causing exactly what you were trying to avoid.