After the caffeine from my coffee wears off, I get migraines. Should I stop drinking coffee altogether? I don't want to be dependent on it

Sounds... Sounds more like caffeine withdrawal headaches. Aka caffeine rebound headache. You may need to simply taper of caffeine and see how things evolve over the ensuing 3-5 weeks. Good luck!