Clearly this depends on Jurisdiction, but for example grandfathered in electrical outlets are fine but kitchens and bathrooms almost always need more expensive ground faulted receptacles according to the National Electric Code. When human health and safety is a clear immediate risk such as this then it usually has to be torn out.
In California they have CEBC based on the IEBC, which requires old buildings to meet their own separate building codes.