It "can" happen, but it's not that easy to do. It happens by accident or intentional misuse of the system.
Because DCS is a 2 way communications system, when you add an engine, it queries the track, the engine responds with it's stored info, it and the remote or app instance negotiate the free address in the database, and then the engine and the remote or app instance now store the new ID.
As an example, say you have 2 remotes. In DCS the remote stores the database (unlike Lionel Legacy, where the base stores the database and the remote is generic). So with 2 remotes, you technically have 2 databases. You add one engine to one remote and make a note of that address. You then add the second engine to the second remote, and ensure that address is free and might have to change the negotiated address to that free address slot.
Now, technically, both engines respond to the same ID from either remote- although likely, there might be errors and other problems.
Again, the system honestly discourages this and tries in a lot of ways to prevent it, and the 2 way response on every command may show errors when the invalid or duplicate response is received.
Alternative solution- the all engines command. This specifically is designed to work with the active VS inactive list system and only active engine IDs work on the all engines command. So you just add each engine normally. Then with both engines on the track- even with separate IDs and they are the ONLY MTH engines on the track, perform a read command to ensure both are active and all others are inactive, and then use the all engines command.