Your explanation of start of Korean War is correct and it’s true. However US led Allie advanced to North Korea and China border that is when Chinese Government decided and reacted to Korean War. Chinese Military pushed Allies back 3\8 line, that is exactly where straight after WW2 US and USSR agreed. That also explains South Korea doesn’t like China as whole. Fast forward recent years, after China has opened economic door, Chinese economy quickly risen up, China became the biggest economy \trading partner of South Korea both import and export. Also China also has been distant to North Korea as it has not changed much politically and economically In 2016, South Korean Government let US build ballistic missile bases in its land and not only those aim for North Korea for its own defence but also aim at China major cities. That is why China attitude towards Korea has drastically changed.