Optimize ActiveRecord::Relation Patching

I've replaced the singleton class operations called within initialize with a subclass and a simple branch in `new`. This should help a lot with type sensitive platforms like JRuby which fail to JIT such polymorphic code.

The patch attempts to be self contained changes and as such it's rather hard to make it much cleaner but it seems to work in real applications I've tested. One caveat is that we now have a single failing test. This doesn't seem to affect any applications I checked but it will likely be worth following up on before pushing this completely upstream.