Some writers start with a title and then write the article. Other writers start with the article and then write a title. The writers who start with a title end up with better titles. The writers who start with a title tend to write better articles too.
Good writing conveys a single point. Titles keep your writing from meandering. Sometimes these meanderings lend themselves to new titles. That's fine. Titles are allowed to change. If a digression do not lend itself to a new title that means your writing has become disjointed. A title constrains your writing in a good way.
I was once hired to help another blogger create better titles for his blog posts. He is a good writer and a knowledgable person but his articles lacked punch. They felt aimless. I invented good titles for his articles. But the titles didn't work immediately. The blogger had to remove and rewrite large chunks of the articles that weren't germane to my titles. It would have been more efficient if he had just started with a good title in the first place. Also, his articles took longer to get to the point than they would have if he had started with a title.