I've pushed the fix for this issue to all the branches down to 12. Thanks for the report and the analyses.
pgsql-bugs by date:
Соглашаюсь с условиями обработки персональных данных