After finishing my Master's degree, I had a couple of options (company offers, a startup idea plus co-founder, a four-year research position). I chose the research position, which cumulated in a PhD thesis. Afterwards, I worked for a company for six months in NLP and machine learning. Now I am in a research position again in a different university.
The pay check may not be as good as working in some companies, but working in academia provides a lot of freedom to try ideas, do it your favorite programming language, go to conferences, and visit far-away countries.
Academia is certainly not a good option for everyone, but it's certainly something you could consider.
That said, I don't exclude the possibility of going to industry again later.