Laptops should have a switch to disconnect the battery when they are plugged into a power source to prevent unnecessary battery wear. Ideally, this should be a physical, manual switch that can also be controlled by software.
Modern laptops shouldn't be drawing their power from the battery when plugged in though, and they should stop charging the battery once fully charged. The only potential issue is that they typically keep the battery charged to 100%, while keeping a lithium battery closer to two-thirds charge tends to be a lot better for its long-term health. All they really need is a software option to keep the battery at a reduced charge level when plugged in for extended durations, togglable to a "full charge" setting for when optimal runtime away from a power source is needed.
And Windows actually has something like this called "smart charging", that can limit the battery to around 80% charge when plugged in for extended durations, though I think it's only available on a limited number of laptops. It also doesn't offer any way to manually control whether the option is turned on or off, instead basing it on recent charging habits, which doesn't give the user much control over it, and actually getting the feature to enable is apparently hit-or-miss, even on supported hardware. Some laptops will also include a similar "battery limit" setting in the manufacturer's bundled software or in the BIOS though, that can be toggled on or off, which would be a more reliable way to do that. It would be nice if a universal toggle like that were included in Windows, though perhaps it might be difficult for Windows to accurately determine the exact charge level of a variety of batteries when not charged to 100% for extended periods.
But even with a physical switch, the heat from the laptop could still degrade the battery at an increased rate over time. The best physical option would simply be a battery pack that's removeable and easily replaceable, something that was the norm on most laptops until falling out of favor in recent years as devices became thinner and lighter. Manufacturer's don't really gain much out of making a device last for an extended number of years though, when a failing battery will just make people more likely to buy a new device from them.