It's more complex than you claim – I've worked with a few of these systems.
There are a lot of edge cases; consider that in some cases devices being used a full-blast power can draw more current when operating then a charging device can supply, meaning they can still discharge batteries even when AC power is available. (Apple example – smaller power adapter than supplied. Still technically works to charge, but not supply power. Or any arbitrary 500mA USB charger.)
Yeah, I don't doubt that you could probably engineer something that works. But would the complexity be worth it? Probably not. The fact that every modern device (Apple and otherwise) behave this way should suggest that it's not that easy – if it were, it wouldn't be implemented that way.
There are a lot of edge cases; consider that in some cases devices being used a full-blast power can draw more current when operating then a charging device can supply, meaning they can still discharge batteries even when AC power is available. (Apple example – smaller power adapter than supplied. Still technically works to charge, but not supply power. Or any arbitrary 500mA USB charger.)
Yeah, I don't doubt that you could probably engineer something that works. But would the complexity be worth it? Probably not. The fact that every modern device (Apple and otherwise) behave this way should suggest that it's not that easy – if it were, it wouldn't be implemented that way.