Is there any way to include the rows where the predicate evaluates to null while still using an index?
That seems quite unlikely. Your definition of equality is incompatible with the system’s standard definition while requiring that the standard equals operator be used in the query. Null values and non-null values are not considered equal, or, put another way, always considered distinct from each other. A btree index, which handles =, can’t be told to behave differently and so cannot fulfill your desire to produce rows where the stored value is null; it can only produce those equal to 5000.
David J.