You’re right - most media formats have support for metadata, which can include all sorts of things depending on how the image is created. For instance, most phones have an option to add location data to photos.
A lot of identifiable info like location data is usually an option you can turn off. And there are a lot of tools to remove metadata from files. A quick search brought up this, which seems fairly reputable (and open source, which is usually good for sensitive stuff like this).
There’s also general gatekeeping of their developer tools which restricticts ports of software, and not following standards properly (USBc, sms).