Stop the expansion of decision trees for slice patterns as soon as possible

Fixes #17877.