Efflux pumps are a really cool way for bacteria to get rid of harmful substances. Bacteria have used them for a long time, for a lot of different substances. They certainly predate prescription antibiotics by a lot. It’s also good to remember that it was nature, not us, who originally invented antibiotics. Like, if a bacteria gets all up in the face of a fungus, the fungus is going to protect itself.
Many bacteria have these kinds of pumps from long ago, but our over-use of antibiotics just makes them more effective against modern drugs and more wide spread.
Reygaert (2018) contains an extensive overview of antimicrobial resistance mechanisms, including efflux pumps.
Reygaert (2018) An overview of the antimicrobial resistance mechanisms of bacteria https://doi.org/10.3934/microbiol.2018.3.482