But the battery starts to become weaker - and I have some trouble with the charger (it's on the device, not the cable). Too bad it's always so hard to exchange battery in these devices.
If you're a tinkerer, I'd seriously recommend using something like ACC (Advanced Charging Controller). It'll automatically cut your charge off at ~80% and slow the charging if it's heating up too much. Should greatly extend the service life of your battery. You can pretty much just install with Magisk and forget it. Perhaps it's too late for your current phone/battery but maybe on the next one.
On normal Linux, if your device has a proper PMIC with a driver that allows this, you can just change the max charging voltage to something like 4.1V or less via sysfs (/sys/class/power_supply/*) on each boot. You can do the same for maximum charging current, to avoid so called "fast charging", and charge at 0.2C for example. And that's it.