MB-8648: Cleanup couch_index_merger code a bit

Extract validation functions from couch_index_merger into a
separate module, so that other indexers can use them as well.

Change-Id: If45cc878f46d967e32762905a21c4027f5d2ec16
Reviewed-on: http://review.couchbase.org/27542
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>