I gave up using file names for metadata (besides they vary in format) a long time ago.
Is there a reason to not use the Books metadata as a primary source? Preferences: Adding Books:Read from Contents rather than file name
It the few cases like your first example. I use the Bulk Metadata edit (after import) to rearrange data

It has a WYG (What You will Get) view on the right.