Read up on custom vs. generic plans for some more background on this.
Thanks for the hint, the query works again with
set plan_cache_mode to 'force_generic_plan';
pgsql-bugs by date:
Соглашаюсь с условиями обработки персональных данных