In the Toy Story segment of Kingdom Hearts 3, it’s explained that some unknown force unique to that world causes toys in that world to become imbued with Hearts (a spiritual organ responsible for your ability to feel emotions, which is apparently distinct from a person’s soul), and that this imbuement is what causes the toys to come to life.
Their connection to the children who own them does seem to create those Hearts, and it seems to strengthen their Hearts, as do their connections to other toys, but it’s not responsible for the process of them becoming imbued with their Hearts in the first place and becoming animated - that's some process in that particular world that doesn't seem to occur in other worlds, barring deliberate magical intervention.
We can see this in this video, where Xehanort causes a Heartless to take over an inanimate toy, stating:
One heart's shadows fill the emptiness of another. See how they bring him to life? Like Heartless and Nobodies, they fit together.
This is evidence that the toy had had its heart removed, or had a "space" for a Heart to be placed in, since when a person's Heart is corrupted by Darkness, it becomes a Heartless, with their body and soul transforming into a being called a Nobody. Later in that video, we can see a couple of toys that have been animated by a Heartless, and since they've got the Heartless symbol appearing directly on them, we know that they're being directly possessed rather than simply piloted.
Later, in one of the climactic scenes, Xehanort states:
In this world, toys have hearts. And those hearts come from a powerful bond.
In a following scene, he states:
So, even empty puppets can be given strong hearts. ... But now I know that a Heart can be placed in a vessel of our choosing.