(My quick and dirty patch posted there still compiles and works, if you would like to test that it fixes the problem for you.)
Because the number of rows is vastly overestimated, so is the cost. Which then causes JIT to kick in counter-productively, due to the deranged cost exceeding jit_above_cost.