The best explanation I can think of for these humoungous salaries is some combination of butts in seats and TV ratings.
That said, however, the LA Angels, who have been consistently lousy on the field, have regularly drawn 3M+ in attendance, even before Mike Trout arrived in 2011. Less surprising is that the Dodgers have always drawn well and usually lead MLB with 4M annual attendance. They did not need Mookie for attendance purposes.
So too the Sox with the 2d smallest ballpark in MLB. In the early years of John Henry's reign, they were always "sold out" and drew 3M a year. Since 2009 or so when the Sox finally admittedly they were padding the attendance numbers. the worst they have done is 2.8M+ and that includes when they were dead last in the AL East. Thus John Henry probably didn't need Mookie to maintain attendance.
The Phillies, on the other hand, might have been smart to pick up Bryce Harper because attendance jumped a lot from 2018 to 2019. Without Harper in 2018 it was 2.158M. With Harper it was 2.727M in 2019.
And the reverse happened to the Washington Nationals, whose attendance before Bryce Harper's rookie season was 1.9M and thereafter was around 2.4 to 2.5M. After they lost him, their attendance dropped from 2.53 M in 2018 to 2.26M in 2019 even though 2019 was the year they won the World Series.
I think the idea of Bryce Harper, especially given his first full season in MLB (2012) was at age 19, is far greater than the actual performance on the field. He's had two good years out of eight (excluding 2020 and 2021): his rookie year, 2012, when his WAR was 5.2, and three years later when he was the NL MVP with a 9.7 WAR. In the other six years his WAR's were 3.7, 1.0, 1.5, 4.8, 1.8, and 4.5. For that 1.8 WAR in 2018 (in which he played 159 games) he was paid $21.6M. As soon as he left (2019), the Nationals won it all, so his "production" wasn't missed, but the idea of him was.