Is it better to have a strong thesis, or to follow personal interests during PhD?
The papers are more important.   They have way more impact than thesis.  Especially on technical fields.  

Your thesis will be pass fail usually.  May be written up just because advisor says you are ready to go.  This us different in humanities.  

Depending on your results you may even have to be creative and mash a snowball together from scattered work.  Assigning a theme even if there isn't quite one.   Not ideal.  But happens. 

It can also happen if you are strongly productive to just pick one part of your work time be the thesis.  It is also not uncommon to see students do a couple areas and eventually abandon one usually the first.  Often because it has more results.  This can even happen quite late in grad school.  

The dirty secret is that the thesis is just a school drill.  But papers for the literature?  That is playing with the big boys.  

A different question to ask is if you will produce more by sticking to one area or moving around.  Really you need to make your own guess on efficiency and how target rich the areas are.  In all cases you need to consider what to invest time on. But I don't think of it as thesis versus papers.  It's always papers.  Just on what topics.  Thesis is just a glorified term paper.