It's also pretty clear to me that the fact that enable_indexscan and enable_indexonlyscan work completely differently from each other is surprising at best, wrong at worst, but here again, what this patch does about that is not above reproach.
Yes, that is wrong, surely there is a reason we have two vars. Thanks for digging into this: if nothing else, the code will be better for this discussion, even if we do nothing for now with disable_cost.