There's no reason think that removing pilots altogether would enhance safety. Military experience has shown that mishap rates for unmanned aircraft are significantly higher than similar crewed aircraft. Routine flight operations can be automated pretty well now but where human pilots really earn their pay is with handling emergencies and other unexpected situations. The variety of potential emergencies is effectively infinite so it's simply impossible to write and test code to handle them in advance. Instead pilots have to improvise in real time based on intuition and first principles logic. Current AI technology still isn't capable of that.