Even if Affleck wasn’t going to exit the role now, there’s only so much longer he could keep going.
Bruce tells Alfred in Batman v Superman that they’ve been waging war against bad guys for 20 years, and in Justice League, he admits to Diana that he “can barely do it now.”
Zack Snyder’s casting an older actor as Batman was due to Batman v Superman: Dawn of Justice being partially influenced by The Dark Knight Returns, but by doing this, it also cut down on the amount of time we could spend with this iteration of the character.
But by selecting Dick Grayson to succeed him, Affleck’s Bruce, should he be injured or just decide he can’t be a vigilante anymore, can still be involved in this life, albeit in a behind-the-scenes capacity.