I didn't apply for PhD programs before getting my master's, but for me, I believe it was a huge boost to my application. I was pretty sure I didn't have the credentials to get into a great PhD program two years ago. One reason was that my undergrad research was superficial (data collection without much involvement in anything else). Another was that I had ideas about what I wanted to research, but I knew I needed to learn more about those topics, narrow it down, and get more specific. In my experience, it's been really valuable to have planned and conducted my own research, not just for the stuff that's been added to my CV but also because I got really specific in my research interests, I know the literature better now, and I know that I 100% love doing research.
If you think you have work to do in those areas (or if you just need to get some publications), then a master's might be a good route. If you pursue a master's, just make sure that research is a big component of what you'll be doing. I did coursework and research, but I was able to spend most of my time on research, and that boosted my PhD application.