Database queries are a lot more complex than a pattern match search. In addition, grep et al aren’t part of the file system in both the simple sense (they ship separately) and the meaningful sense (filesystems are rarely designed to facilitate them).
> grep et al aren’t part of the file system in both the simple sense (they ship separately)
It seems you are confusing database with database engine or possibly database management system. Querying is not a function of a database.
In fairness, the lazy speaker often says "database" in place of "database engine" and "database management system" to save on the energy of having to make additional sounds when one can infer what is meant by context, but in this case as "database" means database...
> (filesystems are rarely designed to facilitate them)
Facilitating querying is a primary objective of a filesystem database. What do you think "path/to/file.txt" is? That's right. It's a query!