I know this post is a few months old but I came across this problem after upgrading to 9.24.12. For anyone who comes across the post, I got an answer from Mendix who had the R&D team looking at it. Turns out it's a bug on the Mendix side which will be released at varying times.
Quoted from my ticket:
"They have indeed found the issue and agree that it is a bug from our end, and are trying to fix the same. This fix is expected to be released in 9 LTS, Mx10.6 MTS, and the latest Mx10(.7). Although the release might depend on other factors, the team will try to push it after it is fixed. With that being said, they have also let us know that unfortunately, due to the nature of the issue, there is no workaround aside from not using the “Select” button in a Datagrid."
I know this doesn't help fix it, but at least there is an answer for it.
UPDATE 1/18/24: Our R&D team has updated that the reason this current system fails is because it tries to save all unsaved objects on the form. In this project that is actually the environment object in the snippet. -- Attempt to commit all unsaved objects to see if it goes away if it is causing issues in the application. This is still to be fixed by Mendix but it has the core issue found that you might be able to fix it temporarily until put into a release.
Update 2/19/24: This issue has hopefully been resolved in LTS 9.24.16, my ticket was noted as put into the modeler release.