I can't really tell. My gut tells me it is not about China or US, it is about their personal reasons. It just happened to align with US interest this time.
Imran Khan is getting too popular for military junta's comfort. They removed Imran because some of his policy and orientation is unconductive of elite's interests, not that they prefer US over China in particular. All US needs is a little bit nudge here and there helping it happen. Most of the drivers are within Pakistan.
You are absolutely correct. The removal of Imran Khan had little to do with China, but more with appeasing the Americans. There are also domestic issues at play. Pakistani military and other elites aren't used to being called out for corruption and malpractice. Imran Khan has ruffled many feathers in Pakistan, namely:
1. The bureaucracy in Pakistan was angry because his party initiated certain changes that didn't sit well with their corrupt ways.
2. The teachers in Pakistan were angry because for the first time they were forced to attend a class and teach the pupils. Otherwise no salary. Normally Pakistan has ghost schools.
3. The judiciary was angry because they were unable to openly commit fraudulent cases.
4. The Americans were upset because Imran Khan was openly talking about an independent foreign policy which aligned with the Pakistani state's interest.
5. The Pakistani main stream media was angry because normally they are used to receiving bribes for reporting. During Imran Khan's tenure such bribes were termed illegal.
6. The Western powers were angry because Imran Khan didn't tow their line on many issues. Imran Khan was a fierce proponent of independent policy and sovereignty.
7. The Pakistani army was very upset with Imran Khan because he was obviously challenging their hegemony within Pakistan. Normally all domestic and especially foreign policies are formulated by the Pakistani army. Imran Khan sought more power to be able to formulate policies at a governmental level. The generals didn't like it.
The gist is that many actors were upset with Imran Khan and the policies of his party. Imran Khan and his party were far from perfect and also made mistakes, but that did not warrant removal from power. Overall the people were satisfied with Imran Khan's political and economic policies versus the established order. It was easy for the Americans to instigate the Pakistani military and opposition to remove Imran Khan from power. Imran Khan is not an easy person who would simply give up and flee like his predecessors. He fought for what he termed Pakistan's cause, but you cannot win against those with ultimate power i.e. the military generals within Pakistan. Things got very much out of hand and the fight between Imran Khan and the military was played out in the open where the Americans supported the opposition and the military generals. The people of Pakistan overwhelmingly support Imran Khan, but the military, opposition and the US wouldn't allow free and fair elections. The elections have been delayed again recently. Until Imran Khan is completely out of the scene elections in Pakistan will be postponed indefinitely. The US claims to be neutral and terms Imran Khan's detention as Pakistan's internal matter.