SERVER-14180 fix double free in access planning for $elemMatch

(cherry picked from commit 2453cec627bb8f6100980dea273ac9eb54ecd645)