spec out #745

(This has since been solved by #771).
Refactor `prepended_modules_of_singleton_class`.

The `take_while` implementation was a bit obtuse.

It is simpler to just find the index of the singleton
class and then just return all ancestors before it. This
ensures that only modules which are prepended onto the
specific singleton class we are dealing with (and not the
singleton class of a superclass...) are considered, which was
the root of the problem causing #745.