I dont think i know enough details, because im afraid i dont understand the situation correctly.
However, if i understand it you are trying to sync entity IDs over network so multiple games on different computers would have same entity IDs.
Since you are dealing with networking you must have a server and it should be the server's job handling the IDs. So for example when an entity is created the client should send a request for new id to server(would also have to send the type and initializing component data) and server would then send the id, type and serialized component data to all the clients except the first one which would only get the id, so that they would all get to know about the new entity(this would apply for bullets for example when the player shoots a bullet the bullet would be created on player's computer and so on ).
It would be different regarding the world. AI, map generation, etc. should work on the server. Any kind of world entity would be created on server because all the clients must have the same world experience.
Regarding the file reading / writing of the component data it should again be the server's job doing so. This means that for example when the server would start it would read the files and initialize the components and then the clients would send requests for intialization data that the server read from files. Each client would confirm that they recieved the data and when they would all confirm server would start the game and so on.
All in all make sure that server controls the IDs and be careful with situations like coop mechanics where the server would actually be one of the clients so then that one client doesnt need to run a seperate server program but rather just open a server within the game and use it for its own game as well(it would simply share its game data with other clients and would recieve events from other clients).
I made up the exaples stated above on spot and i do not know if those are best solutions and i do know they are not accurate and they are not complete. However, i wanted to support the idea with examples, so it really depends on you how you will actually implement this idea, if you ever will that is.
I hope i didnt misunderstand the problem or that i didnt forget anything important regarding it and i hope i helped. I wish you the best of luck with the engine :)
I totally missed the point here with this answer(for some reason i totally missed the p2p part).
As you have p2p you want to sync IDs every time an entity is created / removed. When entity is created for example just sync the new ID and data. Now with this approach you would have to do that for every entity and it could hit the performace dramatically. You dont want to sync every entity out there, so what you could do is that you logically divide entities into sync and non-sync entites and have those groups generate seperate IDs for their own entities. You could also approach this by still having all the entities with same ID generation and just create a hash table for sync entities. There are probably some better ideas, since I just made these up on spot, but this should give you an idea to think about. The latter is imo better since you dont have to optimize the core of your ECS but you can just add the hash table elsewhere(p2p network module or sth), it is also better regarding the performance.
When saving to files you should just save the hash table as well and you are done.
I hope I helped this time and that I didnt miss the point again. Again, good luck :)