We all know that the sun generates its energy from nuclear fusion in the core. The electromagnetic radiation produced slowly travels upwards, while constantly being absorbed and re-emitted by the charged ions, until it reaches the photosphere, where it can basically travel freely (because there are less charged ions), until it travels out into space and then into our eyes.
But I just realized that this doesn't seem to be consistent with the exercise where we calculate the surface temperature of the sun using the Stefan-Boltzmann law. This law is a consequence of blackbody radiation theory, and so by using this law, we're now assuming that the sun's energy comes from the thermal motion of the particles in the photosphere. But as explained in the first paragraph, the energy actually comes from nuclear fusion deep in the core. I am probably stupid for not figuring out how these two explanations of the energy are consistent, but apparently I can't and I need help. Is it because the radiation from the core is absorbed by the photosphere, and then being re-emitted as blackbody radiation? Or is it because of something else?