That's why there are cameras that wind the exposed film into a covered chamber, or wind the film at the start completely onto an open spool and wind exposed film back into the cassette.

Strange enough there seems to be no design with a secured back door lock that only opens when there is no uncoverd film in the film chamber. (This needed to include an overide in case of malfunction).