Ronaldo, in his first pre-season game, had been replaced at half-time.
He was pictured leaving with Diogo Dalot, who had sat in the directors’ box with several players, all of whom left 10 minutes before the end.
“We are a team and that means you stay until the end,” Ten Hag told Viaplay.
“This is unacceptable, for all those involved.”
United drew the game 1-1, with Ronaldo unable to mark his return to action with a goal.
The 37-year-old, who returned to United last season after spells with Real Madrid and Juventus, is keen to move away from the club to pursue his desire to compete in the Champions League.
And he was allowed to miss United’s pre-season tour of Thailand and Australia for personal reasons.
Ten Hag has previously said Ronaldo is “not for sale” and remains “in our plans”.
New signings Christian Eriksen and Lisandro Martinez both featured for an hour against Rayo, in a game set up by Ten Hag for the players who were not involved extensively in Saturday’s 1-0 defeat by Atletico Madrid in Oslo.
United open their 2022-23 Premier League season at home to Brighton on Sunday, 7 August.