Cannot load custom keymap / custom keyboard shortcuts (Version 2.8 / 2.9)

I have a problem with my blender versions 2.8 / 2.9 that I can’t find an answer to anywhere:

I am using a couple of addons and have customized my keymap heavily.

If I export my keymap into a .py file and immediately try to import the same file again even without any changes, I get an error “Failed to load keymap XYZ.py”. There are no entries in the system console or in the python console that would elaborate on what the problem is.

For anyone who wonders why I would be doing that, this is the reason:
In hope of migrating smoothly to later builds of blender I exported my user preferences plus the keymap, but I am running into the same problem. When I try to load the keymap in another build (or even just a copy of the same build) after applying the preferences to the new build and after loading all the addons involved. I also tried saving and restoring settings via BlenderCloud, but still can’t load the keymap after loading the settings.

Therefore I figured: If I cannot import the same keymap in the build in which it is working nicely, there must be something very wrong, probably with my understanding of the concept here, right?

Does someone know what I am not getting?

Is there a way to see in more detail what causes the loading operation to fail?

I would be very grateful for any help on this problem.