I suspect there’s a fair range of targets and rationales. Eg Australia mandates “deinsection” of all aircraft arriving Australia
Department of Agriculture and Water Resources Aircraft disinsection
note there’s also multiple methods allowed, so even if the plane is not visibly sprayed by the cabin crew, doesn’t mean deinsection hasn’t happened