While upgrading Mongoid to 9, I discovered a problem that the relation options got overridden and caused very strange behavior, first reported to Mongoid JIRA.
After investigation, I found out that the problem is in overwriting the relation options here
My temporary patch is to add
to the beginning of that block.
Note: this problem can be reproduced only by invoking the eager-loading before invoking the relation, because there is a memo here