Is your question about how the clitic ends up close enough to the verb to become reinterpreted as an affix? Or is it how personal pronouns end up as clitics?
I'll assume the former and just point out that clitics don't act like personal pronouns. For instance, they're often not where you'd expect to find the personal pronoun. In most cases in Romance languages (SVO), object clitics are to the left of the verb, whereas a corresponding full pronoun would be to the right (in unmarked declarative clauses). It's conceivable that clitics in SOV languages can end up being verb-adjacent, but hopefully a typologist will confirm this.
Edit: Justin rightly points out that Romance clitics originate in SOV Latin, which goes back to the question of how pronouns (or demonstratives) turn into clitics in the first place. I'm not a historical linguist, but see e.g. Kempson & Cann 2008 for a functionalist-inspired analysis (spoiler: syntax and pragmatics conspire). Let me also turn to the typologists for a statement that perhaps applies more to the original question on SOV languages:
in many other [i.e. other than English] languages, pronouns exhibit word order properties that
differ considerably from lexical noun phrases, either because the
syntactic rules of the language treat them differently, or because the
pragmatic rules are such that their distribution is rather different. (Dryer 2007)
So yeah, syntax and pragmatics.
If you want to deal with clitic placement in syntax, you can either base-generate them in their normal argument position and then raise them to be adjacent to their host (the verb), or you could base-generate them in a special functional projection that's already next to the verb. In phonology, particularly in Optimality Theory, people usually use Alignment constraints to specify where the clitic likes to be wrt its host (left edge of the host or right, left edge of the phrasal projection of the host or right of it).
References:
Anderson, Stephen R. (2005). Aspects of the Theory of Clitics. Oxford: Oxford University Press
Kempson, R., Cann, R. (2008). Production pressures, syntactic change and the emergence of clitic pronouns. In Cooper, R and Kempson, R (eds.) Language in Flux, 178-220. College Publications.
Dryer, Matthew S. (2007). Word order. In Timothy Shopen (ed.) Clause Structure, Language Typology and Syntactic Description, Vol. 1, 61-131. Second Edition.
Franks, Holloway King (2000). A Handbook of Slavic Clitics. Oxford: Oxford University Press