I believe that monitoring internal components is exactly why temperature sensors are useful: the device can shut itself off it it becomes too hot. This can happen if the it has been left on the dashboard of a car during the summer, for example. This can help to lengthen the lifetime of the device.
This is indeed a common use case for temperature sensors in embedded devices, and I very much doubt there isn't one in the S5. Temperature sensors are included in pretty much all inertial sensor dies nowadays, both for offset/drift calibration and thermal shutdown protection. It's more likely that Samsung simply removed application-level access, although I don't know why they would do so.
All cellphones (even very old ones) have some sort of temperature sensor. This is required for dealing with components that are sensitive to heat (oscillators for example).
These are usually not accessible to applications since they (by design) do not report the ambient room temperature.