I discovered the issue. Even though the error was happening on this line, it was caused higher up in the code in a section not in the example:
...
QBatch.Open;
QGetLastBatchNumber.Open;
...
These were two TUniQueries that both accessed the same table called BATCH with different sql statements. So the error was actually that I was trying to make two connections to the same table in a transaction. I do not know why this wasn't an issue before Delphi 12.2 and I do not know exactly why the error triggered on QBatch.Post as opposed to when I opened both tables, but if you have a similar error, you can look to see if you have two different TUniQueries open that connect to the same table within a single transaction.