Yes, you are looking at the outer layer
All the heat and light from the Sun is emitted by that outermost layer, which is essentially opaque to the processes going on inside it. The solar spectrum is a very good fit for a black body, and thus a black body temperature calculation applies to the surface of the Sun. It's not that hot, at around 5700 K.
Yes, inside it gets hotter. A lot hotter
5700K is not hot enough for fusion, unfortunately. As you correctly guessed, most of the light generated in the core stays there. At the core, the temperature is millions of Kelvin, and more than a hundred times the density of water as a plasma.
Remember the Sun is a big gas/plasma ball
The size of the Sun is governed by the balance of forces; outward pressure from the plasma which wants to expand vs inward pull of gravity. If there was more energy generated, that would tend to make the ball expand - there's no 'surface' to constrain it. So the surface and its properties are entirely a product of the energy being generated within the ball, and in fact largely at the core.
What escapes is not a small fraction of the energy being generated
The Sun is in a (broadly) stable state - it's not getting bigger or hotter. And the energy released by fusing nuclei doesn't have any other place to go; it's not going to go back into the heavier nuclei and split them up. So if the Sun is stable, that energy must all be flowing out in one way or another.
We know, then, that the total energy being emitted by the Sun's surface is equal to the amount of energy being released by nuclear interactions at the Sun's core.
We aren't saying the Sun is just a hot blob
By modelling the Sun as a black body, all we are saying is that we can see its spectrum matches that of a generically hot thing at a particular temperature, and from there (and some assumptions about it being basically the same in all directions) we can work out the total power output of the Sun. We haven't had to make any assumptions about what's going on inside the Sun, only observe what reaches us and infer what must be coming out overall.
With this knowledge we can start to infer what must be happening inside
We know some things; how much power the Sun is producing, how big it is, the proportions of atomic species at the surface (from the details of the spectrum), its overall mass, the laws of gravity and the behaviours of plasmas. From that we have to try to model what must be happening inside.
We have inferred, for example, what the dominant nuclear processes inside the Sun must be; we know the temperatures and pressures are not high enough for some cycles, but high enough for others.