We can easily hit file system limits for some record types (all files relevant to anything).
If the individual records are small, it can make sense to compile multiple records into a single file. In YAML/JSON, the first layer of an object could be a record ID.
A dedicated set of ID functions should support that. Maybe IDs with a colon delimiter. Before the colon is the file name, after it there record ID.
This has trade-offs, of course. More data needs to be read, before the actual record is found. Nothing is perfect.