Using filenames is not mandatory with Lokalise, as you can configure the exported .zip bundle structure as you prefer. In case you still wish to keep keys arranged by filenames, there are several things to consider:
When importing source file, keys are automatically assigned to filenames. You can choose either to distinguish imported keys by filename or not, though.
Adding a new key via web interface or API, you can either keep it unassigned to filename or assign to existing / create new filename.
When exporting, make sure to check "Use original filenames and formats" checkbox so the generated .zip bundle is respective to desired filename allocation schema.