Lithium ion batteries
Most countries/groups of countries have some markings require various safety features to allow sale of products.

IIRC the safety requirements required for UL with Li-Ion batteries state that if the charge controller of the battery fails as a short, the battery still must not be exposed to more than a 10% over voltage. There are two ways round this: have a second battery protection method or rely on some volt drop inherent in all electronics.

For second battery protection, this isn't that much of a challenge, as many devices have high side switching for some control, and low side switching for other control (personally I've designed something which had a BMIC controlling the low side, and a processor controlling high side). Or it could be a more passive method, such as a thermal fuse. These are used in various products so if the battery gets hot it isolates it completely.

As for inherent voltage drops, that's quite easy to put a protection diode in the charge path (which is a common requirement for other reason), this will drop the voltage by a chuck (0.5V is quite common) without any issues.

You are specifically talking about mobile phones which use USB to charge them. The phone usually has a dedicated USB control IC built in, this can isolate the USB power normally, and there is usually a dedicated charging control IC, which can also isolate the power. So, the quick answer is; they have two charge controllers. You could say "what if they both fail", usual safety rule would be if one is detected to fail (current still flowing when it's off) then the unit can go into a "non-operable mode", and so the user returns/throws it away rather than uses an unsafe product.