Actually, reporting indicates that indictments were imminent when Trump declared his candidacy--that was the trigger for the special counsel.
Once a candidate declares, the public interest factor as well as the sensitivity of the issue become more pronounced.
Garland made clear that once he was dealing with a 2024 presidential candidate, he had no choice but to appoint someone else to take over.
I suspect Trump's spies within the DOJ helped him decide to announce when he did--because they knew if he announced before an indictment, it would slow things down. And, indeed, it did.