Allocate far fewer strings from lib/mongoid/threaded.rb

In the process of memory profiling an application that uses Mongoid, @ersatzryan and I discovered that Mongoid's `threaded.rb` is responsible for generating hundreds of thousands of new strings during our test case. In fact, Mongoid's own test suite generates 1,075,171 new strings just in `threaded.rb`.

Defining constant thread variable keys and memoizing stack keys drastically reduces the number of new strings allocated during typical usage, bringing the test suite total from 1,075,171 to 102.

Locally, I'm also experiencing a ~4% increase in the speed of the test suite.