The example you listed above only zooms the Layout, not the Map that the Layout contains.
I have tried setting both the MapFrame and the Map. That's what I was trying to say in the last sentence of my last post.
My code is essentially this:
import arcpy.mp
aprx = arcpy.mp.ArcGISProject(r"C:\temp\Empty.aprx")
map = aprx.listMaps()[0]
layout = aprx.listLayouts()[0]
map.map.addDataFromPath(r"C:\Users\xxxxxx\Documents\Test1\Orthomosaic.tif")
mapFrame = layout.listElements("MAPFRAME_ELEMENT")[0]
mapFrame.zoomToAllLayers()
map.defaultCamera = mapFrame.camera
aprx.saveACopy(r"C:\temp\New.aprx")
And the Map is added to the Layout in Empty.aprx before I run this code.
Now when I open New.aprx the map is NOT zoomed to the extent of all layers (the extent of Orthomasaic.tif), however if you look at the Map Properties its extent is set to the extent of all layers (the extent of Orthomasaic.tif).