This one is pretty well known, Elon's stated his position on this years ago. He said SpaceX will NOT go public before they are doing routine flights between Earth and Mars (it's too risky during development, and he doesn't want to lose other people's money).
The reason they WILL go public is if they need capital to finance the City on Mars. Elon said that is his only reason for accumulating personal wealth, and he could well be the world's first trillionaire by the time the last tranch of his Tesla CEO compensation package vests.
That's only 1 trillion, which won't pay for a city on Mars (think 'Order of Magnitude' more costly). Hence, that was the motivation for the original position of taking SpaceX public.
However, I don't think he'll need too. 2 words: Asteroid Mining.
NASA Will Reach Unique Metal Asteroid Worth $10,000 Quadrillion Four Years Early
Think of Starship with a Boring Company TBM in its belly as a cosmic piggy bank, waiting to boldly go into its autonomous asteroid mining future.
Cheers!