SERVER-7685: refactor v8ToMongoElement to reduce stack consumption in recursive path
SERVER-7685: fix build: cast was incorrect
SERVER-7685: fix build: propagate return from new inner function