The skill of a photographer is in the curation of the work.
They are credited with the framing, the positioning, the timing, the settings they used on configuring the camera.
If someone else went to the same location, attempted to frame it, position it, time it, and configure the camera themselves, even if the resultant picture somehow managed to come out identically to the first one - hell, even if they used the same actual physical camera - the photographer who took the first picture has no rights or claims over this new albeit hypothetically identical photograph.
Third example:
If a photographer set up a permanent camera at a location that already had the scene framed, all elements within the frame positioned, all settings calibrated and locked-in, and somehow even managed to make sure that the timing was always perfect every time someone came up and pressed the shutter button, ALL the work was still done by the photographer.
Fourth example:
If an AI algorithmically calculated all of these aspects and robotically configured a camera's settings, then used a drone to deliver and orient the camera precisely to achieve the framing and scene composition as determined by the algorithm, then were to schedule the exact optimal moment to trigger the shutters each time a human pressed a button, that human would have no claims or rights over the resultant picture and it ought fall directly into public domain.