SERVER-10026 limit tree depth allowed by the match expression parser

(cherry picked from commit 926d45b2cd43cf255f0994b9da8e518bc381b794)