"Whether you wish them to or not, many people have users that create file systems with billions of files, and then struggle with the management of said data."
Database Management System. The clue's in the name.
If you're going to create data on that scale you should work out the management scheme from the start or, at worst, as soon as you realise that you're creating more than you intended. When you do that you'll find that there's a choice of engines available off the shelf, commercial and FOSS. The database can hold the metadata that your application needs, which is probably going to be more than the file system provides and the data itself. If your data is in file system files anyone with the right (or wrong!) permissions can just delete some of them irrespective of the metadata saying, via business rules, that it should be kept.
Example: upstream provides files containing up to 1,000 documents in XML format* to be printed on an industrial scale. Any XML file can contain different sorts of documents than require different base stock or printing hardware, some running to 10s of pages. S/W splits them up into the individual documents, transforms each into a form ready for the print formatter and stores it as a database blob. The batching engine gathers up documents of common properties (base stock and printer) ready for the print room operators. Only when a batch is selected for printing is a file system file generated and it contains 1,000 documents or whatever the batch parameters call for. Spoiled documents have their database record sent back for re-batching. Once despatched documents can be purged from the database. The system might have thousands of documents going through it at any one time but there are few actual bulk files involved and only at the input and output. Multiply that a few times for different contracts being handled.
* Yes, technically the file is a document in XML terminology. As each file contains multiple documents in the application domain technology it's easier to stick with the latter and call the file an XML file.