There is a big difference in company ownership and personal ownership.
Musk was personally involved with the Twitter purchase.
Yes he owns stock in both companies but from what I read he gave personal guarantees for twitter and xAI basically functions without him. All he does is own shares and he is basically setting twitter up to run without him in a similar fashion. The sale dissolves his personal responsibilities and shifts them to the company xAI.