The most popular theory is that kneading is neotenic behavior, a juvenile trait that is retained into adulthood, because need to knead their mother’s bellies to stimulate milk production. This would explain why some adult cats suckle whatever it is that they’re kneading. However, wild cats do not knead. So why have domestic cats retained this trait. Well, neotenic traits are more often found in domesticated animals like housecats partly because over the millennia humans have selected for traits that make animals more social less aggressive and generally nicer to be around. But the animals probably also held on to some of the more social baby-like behavior just because it serves them well when they’re around people.
That sounds about right.