In my experience, the main obstacle is the gap between doing PhD research and the "market" out there, with its many journals, high rejection rates, competition, etc.
Universities have all sorts of PhD graduation requirements that are irrelevant to becoming a full-time academic. So, obtaining your PhD will teach you a lot of skills but not necessarily those that you'll need later on.
If you are seriously committed to doing your own research and getting it published, your PhD is not even a requirement. At best, a PhD title is an inadequate proxy for a certain amount of expertise (including a skills set, an attitude, strong ethics) that is being updated 24/7.
So, what it comes down to is that in order to publish that first paper, you need to go start honing a separate skill, namely, translating your (PhD) research into a publishable form. That also means that your work has to contribute to an ongoing, topical conversation among those who are established in your field. Few novice researchers can change the direction a field is going overnight.
A sizeable portion of the papers I review (anonymously) are based on someone's PhD or master's thesis. Practically all of them are rejected. Why? There's no easy, lazy shortcut from thesis to journal article. The journal article is not a summary of your thesis. Think of it as adapting a novel for the screen, it's not just the content that changes, the medium or delivery but also the whole context, with, among other things, a different audience. It's transferring information from one genre to another, meaning that you will have to generate new content.
What the new content will be, depends on the journal you'd like to publish in. However, I prefer to frame this differently: it depends on the conversation (the topics that are current, the controversial debates, the issues) you'd like to contribute to. The reframing backgrounds the whole writing and publishing approach (a shallow way of talking about our profession) and helps you see that what you're doing is adding something (a claim) to some topic or other (for example, the development of room-temperature semi-conductors) but it's not just a hunch, it's a claim that follows from having rigourously applied the scientific method (which I define broadly so it includes a wide range of methods accepted within your discipline).
As a final thought, it's often better to do it the other way round. Let me explain, Defining your PhD area of study should not be solely determined by your interests and enthusiasm: start by reading journals first and find the two or three journals that use your "voice", are concerned with questions relevant to you and that articulate those views or opposing views that you can confidently make a contribution to. Then carry out your research and write it up as an article for one of those journals. When done, convert the article into a PhD thesis.
Two more things. My observations are based on disciplines outside STEM. Secondly, there is a lot of "writing to think" among my supervisees; for example, the discussion of the findings is like a "think aloud" protocol in words, the ideas come during the writing, the writing stimulates the thinking. Though this technique often produces excellent insights, it doesn't mean that this writing-for-thinking journey has to show up verbatim in the Discussion section. The ideas again have to be transferred from one genre (or even practice) to another. This is where your writing becomes writing to communicate.
I think this has something to do with the previous studies. Often the publishing of scientific articles is hardly an issue in the Master's programme. In PhD studies it is all the more important, but the necessary know-how, the connection and the methodology are missing. Therefore, it would be a solution to offer courses in the final phase of the Master's programme that are specifically aimed at future PhD students.