Object masks should be computed on the cropped image, not the original image. Adobe went through a similar learning process with Auto Tone, finally acknowledging that it should be computed on the cropped image:
(But maybe this time it can be corrected in less than five years.)
Here's a use case (original image attached). The original, auto-straightened and cropped image:
Dragging a rectangular Object-mask selection (faintly visible) around the original Polaroid image:
results in a bad mask:
Apparently, the AI algorithm gives more weight to the higher-contrast outer border edges in the cropped-out area of the photo than to the inner border edges within the crop.
Exporting the cropped photo and then making the same rectangular Object-mask selection gives perfect results: