A major car brand will recall thousands of its most popular electric vehicles after discovering a fault that could lead to a fire while charging.