How did Kansas end up sharing Kansas City with Missouri?
It didn’t. Two different cities in two different states. The proximity of KC in Missouri to the State of Kansas was a factor in the naming, as was the location at the confluence of the Kansas and Missouri rivers. In Missouri you had Westport, and on the river Westport Landing to service Westport. This became the Town of Kansas in 1850, then the City of Kansas, and then Kansas City.