Quantized PNGs are a thing and those are not easily detected either. For JXL, most files compressed with Modular mode are lossless. You can detected them in the metadata
The problem is that it's not necessarily trivial to tell programs/pipelines/transforms to act only losslessly (there's definitely no common switch; Quality 100 is in fact still lossy in some encoders/formats). In practice some programs use the extension to realize what they should be doing.
Unlike older formats: