Just an FYI, the ROC takes a long time to be adjudicated.
We filed in March of 2021, and it was approved in October of 2022; others' have taken 3+ years to be adjudicated.
So you could file for divorce in Sep 2024, then file for ROC early Jan 2025, before your card expires, and you might even have the divorce decree in hand before they even get around to looking at your case. If you didn't have the decree yet, they would deny the application and then you would have to re-file.
When you file for ROC you will get a letter stating that you have a pending application, and that letter will extend the validity of your green card up to 48 months. Having an expired green card and no extension letter will seriously hinder your ability to operate, if, for example, you needed to renew your driver's license or something along those lines.