No friendship is forever. Likewise, no rivalry is forever. Those who are friends today might become bitter enemies tomorrow and vice versa. So I don't think anyone should make decisions based on today's geopolitical conditions. These conditions change in a whim.
On the other had, interests are forever. A giant nation like China or the US, should think about how to foster a future geopolitical environment that potentially encourages friendship and collaboration. China's ambitious One Road One Belt project is actually an excellent example of this type of thinking. Don't be so near-sighted about what is happening today. Think about what could happen 100 years from now and how one can "shape the future".
I know this sounds ambitious and even idealistic. However, superpowers with immense resources should think big.
I agree with you, China was very much US's ally during cold war because of USSR, now that USSR is gone, China is challenging US, US is now helping to build up India to counter China, but one day if India gets strong enough, its possible India will also seek to evict US Navy out of India ocean lol. So everyone is playing the power balance game.
But I think there are some rule of thumbs that one can determine who to support who not to support to prevent them from biting you back in the future.
For example, don't give full support nations that have potential to became superpower like China, Russia, India, Iran, Brazil who can be your friend today but rival tomorrow. On the other hand, it should be safe to support smaller nations who had no superpower history, or inferior culture like trait like laziness, deep ethic/religious divide, unhealthy mind set etc.. as they have less chance to get their act together and became a threat.
And, its also much safer to support nations who are not bordering you, or support smaller nations who have problems with another big nation just like you, because you will never be their primarily threat etc... just something of my head.
And yes, the Belt and Road is a good idea, I think if successful its going to bury a lot of conflicts and rebuild a new world order, but that don't mean you cant play power balance game at same time.