Microsoft solved this in COM. Your component gets a 128 bit class ID, and its interfaces also get 128 bit IDs. It's registered under that ID, and queried by that ID.

It doesn't matter what you call it, and what the files are called; two COM objects could both be FFMPEG.DLL or whatever (obviously not installed in the same directory).

When it comes to packages, users interact with the names and are used to writing names into their code when they specify dependencies, so it's not a complete no-brainer solution; but maybe some idea from that solution space could be worked into a package management system.