I'd add a bit more time in China and add some stuff.
14-18th Beijing. Overnight train to Pingyao.
19th Pingyao and area with overnight there
20th Morning fast train to Xi'an. Afternoon Xi'an and overnight.
21st Huashan--whether you do as long daytrip or overnight there, your choice
22nd Xi'an. Overnight train to Lanzhou.
23rd Bus to Xiahe, rest of day there and overnight.
24th Xiahe another overnight.
25th (Early)bus over grasslands to Xining arrive midafternoon; change to fast train to Zhangye and overnight there. 26th Zhangye. Overnight train to Dunhuang (in-town station, get the Y train).
27-28th Dunhuang. Afternoon of 28th share-car 2 hrs to Liuyuan South Station; fast train to Turpan, overnight there.
29th Turpan. Afternoon of 29th, standard train overnight to Kashgar. Take the T9517.
30th Arrive Kashgar 09:00-ish. Plenty of time to go to Sunday Animal Market which is only that day, do that first. The main Bazaar market is open everyday and nothing special about Sundays.
31st to Aug 2 Kashgar region/KKH. Karakul if it's open again to foreigners (likely). If not open, there are other places to go (Shipton's, Yarkand).
Aug 3 Leave for Kyrgyzstan.
This is force-fit to get you to the Sunday Market in Kashgar on July 30. Ideally, you could add a few more days into the China part (PLENTY of options for the extra time), arrive in Kashgar on Aug 2-3, do the KKH or other localized trips, do the following Sunday (6th) for the Animal Market then depart for Kyrg on the 7th. But it really depends on how much time you need for Kyrg.
At the time you will be traveling, longer distance train tickets both sleeper and fast will likely sell out. Given that it's mid-June now, you'd be wise to come up with a plan quickly and book tickets (using an agent) based on those dates. If things change enroute, you can refund tickets and get most of your money back. There aren't a lot of good Plan B options for inexpensive transport to fall back on. Accommodation especially in reasonable price ranges in places that accept foreigners, will probably also be in short supply at least as far as Turpan. In Dunhuang, the Mogao Caves requires advance booking--you cannot see the caves without going on a guided tour, and you'll want one of the two (maybe three) daily English language tours. Suggest that once you get as far as Xi'an or Xiahe, that you see if you can arrange to get a ticket. The website for this is completely user-unfriendly particularly for foreigners, but a call to your Dunhuang lodging might work. Failing that, as soon as you get to Dunhuang, go to the Mogao in-town ticket office to get a tour ticket locked in. There's nothing else on this journey that requires specific advance planning for access, although whether the KKH trip will be doable either independently or with Kashgar guide, is unclear now.