Based on the PR that added hiding the search, FIX: category page improvements by yuriyaran · Pull Request #36062 · discourse/discourse · GitHub, “some conditions” are 10 options.
“hide search input in filters dropdown if list is less than 10 options”
To me, it feels like while they aren’t shown by default, the subcategories that search would return should be counted to determine if there are more than 9 options.