DPI is metadata, not detail
A file has pixels. DPI is a separate number saying how many of them are meant to occupy an inch of paper. Everything confusing about image sizing comes from those two being treated as one.
Two facts, stored in two places
Open any photograph in a text editor and you will find, near the front, a short run of bytes that has nothing to do with the picture. In a JPEG it is a density unit and an X and Y pair inside the JFIF segment, repeated as a rational number in the Exif block. In a PNG it is nine bytes in a chunk called pHYs. Delete those bytes and the image still decodes, still displays, and still occupies exactly the same grid.
What is lost is the file’s opinion about paper. A grid of 1200 by 800 pixels has no physical size of its own; it acquires one only when something states a density. At 300 pixels to the inch that grid is a 4 by 2.67 inch print. At 72 it is 16.67 by 11.11 inches of the same pixels spread much further apart. The picture did not change between those two sentences. Only the instruction did.
This is the whole content of the claim that DPI is metadata. It is a label attached to the data, in the same way that a caption is, and altering a label is not an edit to what it labels.