This answer is a bit more general than your question and I am not a psychologist.
In general, however, in a research field the biggest difficulty in changing subfields (or fields) is when the actual research process is different in the two areas. If that is not the case then one knows how to search the literature, pose questions, construct evidence, and reach conclusions. The process of writing is usually about the same, as is the process of gathering collaborators and others willing to work with you. In particular you don't need another degree and would be bored if you attempt one.
It is good to wait for such changes until you have established a base in your doctoral (sub)field, just to reduce risk to your professional career. It also gives you time and space to do the background reading in a new field to come up to the current state of knowledge.
But, since you have used the "job" tag, I'll add that studying one subfield and immediately, with no further ado, representing yourself as an expert as another is not recommended. Here the gatekeepers would be the hiring committees who would be, at least, skeptical.
And, you might need to be aware and learn of different ethical considerations in the different (sub)fields.
You are wise, of course, to exclude clinical areas from the question since dealing with actual humans and their issues is different from dealing with their data and one can do harm without specific training.
The "dictators" of such things, for entry level university faculty, are those who make tenure decisions and, more generally, those who review submitted papers for impact and novelty.
Note for the US. The US doctoral program, with the typical set of qualifying exams and preparatory coursework, is usually broad enough that a graduate has a comprehensive view of their field, across subfields, as well as their deep dive into their dissertation research. This normally leaves one moderately well placed for movement in the general area.