Before COVID-19, BA's original plan was to have 12 747s left by the end of 2022 with the last aircraft retired in February 2024. As well as the cost of bringing aircraft back into service, it's worth remembering what kept the 747s going in part at BA were the 86J versions that BA could fill on relatively short routes to JFK etc.
With business travel unlikely tor return in meaningful form until next year, it was probably the right to decision to retire the aircraft early.