Step 4: Make the encoder "pluggable"

To be clear, this is making the encoder that powers AS::JSON.encode
and Object#to_json pluggable. The primary purpose of this is to
allow the legacy gem (the pure Ruby encoder with encode_json support)
to hook in nicely and in theory other people can take advantage of
this to write other adapters as well.

If the goal is to use alternative encoders (for performance reason?)
in AR and AP, this commit won't be necessary as those packages can
just use WhateverEncoder.generate(obj) directly instead of calling
obj.to_json. (JSON.generate didn't work before but now that's fixed.)