I asked about this to Matz in the past and it works that way basically as a
consequence of the implementation.
>
>
As you probably know, MRI stores a linear flat chain of ancestors of
a class or module. Each ancestor has a pointer to its own direct ancestor
in the chain of that particular class or module conceptually (there are
indirections but they are not important).

Thing is, albeit new methods are found because method name resolution
follows the pointers at the time of the call (conceptually), and albeit if
you include another module in the very class the pointers are
adjusted, when you include a 2nd order module the ancestor chains of the
classes or modules the enclosing module was already mixed in are not
updated and reflattened so to speak.

Indeed, modules just do not keep that information, they do not know where
they have been included. So that update is not even possible with the
current implementation.

Matz said he would be willing to make this work provided the implementation
had no performance penalty.

Sent from my iPhone