Mattel Inc. was already struggling at the start of 2018 when the finance team delivered more bad news. It had uncovered an accounting error that had reduced Mattel’s loss for the previous year’s third quarter and threatened to be an embarrassment or worse for the toy company.

The maker of Hot Wheels cars and Barbie dolls had just finished a weak holiday season; Toys “R” Us Inc., the biggest specialty toy retailer in the U.S., had filed for bankruptcy; and Mattel had rejected a takeover offer from rival Hasbro Inc. Mattel’s...