This issue was introduced in SERVER-59832.
The changes introduced in that commit assume that we have FCV stability during the execution of an update operation. However that's not true: it could totally happen that we decide at this point that we are going to filter writes over orphan documents, but then when we re-evaluate the value of the feature flag in the getOwnershipFilter function we see that the feature flag isn't enabled anymore and hit the invariant.