This was already fixed by this change: https://github.com/hibernate/hibernate-orm/pull/6704.
I’ve opened a PR adding your test case to the repo, thanks for reporting the issue and providing a reproducer.