I thought iPhones did that secretly for a while and a it was a big scandal.
Most phones do, to a certain extent. The percentage it gives you is just an estimate because you can’t really tell how much energy is in a battery until you discharge it all; you can only tell how much is going in and how much is going out, and make an educated guess from there. Generally, that guess is close enough to reality that it doesn’t make any real difference, so the percentage still serves its purpose. I’m grossly oversimplifying, but that’s the gist.
Most phones these days will usually only charge up to like 95% of the actual capacity of the battery, and will call that 100%.
Apple got in trouble because they made the processor in the phone get slower as the battery got older, not for any of these 80% battery optimization things (which they also support now, but it was added after their scandal of slowing the processors down)
They also didn’t inform the user, so there was no way an average user could know they could restore their device’s old performance with a simple battery replacement