"Tu dois te préparer" means "You have to prepare." Except I don't get why it's "te préparer" instead of the verb itself "se préparer", as "to prepare" is after the verb "tu dois", so there shouldn't be any link to the original subject (right?), just like a normal verb that comes after? So why isn't it "Tu dois se préparer"?
The reflexive pronoun is semantic, so it depends on what you mean to say. You choose the one that refers to the person you mean.
In this case, you'd ask: Who are you getting ready? If it's yourself:
Tu dois te préparer. You have to get (yourself) ready.
Someone or something else?
Tu dois le préparer. You have to get it (dinner?) ready.
Consider that in the infinitive « se préparer », if the verb can be said to have no tense, then se can be said to have no person. It can be translated by the underspecified "to prepare oneself". That makes the following sentence equally nonsensical in both English and French (a frequent bonus when a rule is based on meaning!) :
Tu dois se préparer. You have to get (oneself) ready.
For the same reason, se can be used in impersonal constructions without any issues:
Il faut se préparer. It's necessary to get (oneself) ready.
Don't forget that the third-person reflexive pronouns are also se, which doesn't help to distinguish them, but does helpfully make the range of choices smaller.
Also, I'm not sure whether this is on your radar but if you're having a hard time with "prepare (yourself)" and other reflexive verbs in French that don't make sense as reflexive verbs in English, see this answer. I chose "get (yourself) ready" for this answer because it makes it easier to see how the reflexive pronoun fits into the meaning, but "prepare" would be an OK translation too.
While infinitive clause rarely have a (clearly expressed) subject, they still have an unstated subject, that affects the agreement in person and number of their reflexive pronouns.
Using an example with an overt subject, consider those two sentences:
Que toi tu te sois levé à l'heure, ça m'étonne !
Toi t'être levé à l'heure, ça m'étonne !
They both mean the same thing (That you woke up on time startles me), only differing in the inflexion of the verb, in the past subjunctive in the first sentence and the past infinitive in the second, a common alternation in French. And in both cases, the reflexive pronoun agrees with the subject.
If I remove the strong pronoun "toi", both sentences stay the same, you just lose the strong emphasis on you:
Que tu te sois levé à l'heure, ça m'étonne !
T'être levé à l'heure, ça m'étonne !
If you changed the infinitive verb to "s'être levé", you'd lose the correspondance with que "que tu te sois levé" and the meaning would be altered.
Infinitive clauses subordinate to a main finite verb as in "tu dois te préparer" behave the same way: they have an (usually) unstated subject, that is always co-referent to that of the finite verb: Tu dois [te préparer toi(-même)].
The identity of this "toi(-même)" as the subject of the infinitive is clearer in the other Romance languages because they distinguish subject and object forms of their strong pronouns. In Italian, you'd say "devi prepararti tu" (literally dois préparer-toi toi), with the subject pronoun tu (instead of te, the object pronoun) serving as the optional subject of the infinitive clause.
Remember how I said the subjects of an infinitive subordinate clause and of its main clause had to share a referent? Se is either third person, first person singular, or impersonal. Meanwhile, the main clause "Tu dois" has a second person subject. Which means *"Tu dois se préparer" has a mismatch in persons, and is thus a badly formed sentence in French.
I It is really "se préparer"; for the infinitive used alone "se" is used;
- Se préparer
When the person of the verb is determined then there must be made an agreement with that person;
- Je me prépare
- tu te prépares
- il/elle se prépare
- nous nous préparons
- vous vous préparez
- ils/elles se préparent
Nous préparer est ce qui a pris le plus de temps. (One person speaks for several persons, therefore first person plural (nous).)
Vous préparer est ce qui a pris le plus de temps. (One person speaks to several persons about their preparation.)
Il doit se préparer.
- Vous devez vous préparer.
II "Original subject" describes no reality in the grammatical context of this sentence; there are not two subjects but one: je; in "Je me prépare." "je" is the subject and "me" is a COD (complément d'objet direct). This COD is identified as being a COD because you can only ask the question "Je prépare qui ?" in which there is no préposition; the answer is "moi".
If the the object were a COI (complément d'objet indirect) there would have to be a preposition.
- Il se permet des fantaisies.
Here the question is "Il permet des fantaisies à qui ?"
Whether "indirect" or "direct" is a matter of whether or not a preposition is used with the verb; so you have to know if a preposition is used with the verb before you ask the question. In fact, this knowledge, which you extract from a dictionary if you don't know, is sufficient. Asking the question is a sort of confirmation, a means for the young to understand better as they learn.