It looks like this is a Windows-only problem. My app was created with create-react-app. When I build it in Windows (cygwin environment), I get the problem described above. When I build it using my Mac, the problem disappears.
I assume this is somehow related to webpack and the order in which it initializes javascript modules, but it’s hard to say exactly where the problem is occurring. I don’t intend to look any deeper into it right now since I have a workaround. I just wanted to record my findings for posterity.