A long time ago I saw that when cast in place piles were poured, the rebar cage was lowered all the way to the hole and the concrete was cast. After the concrete hardened, the soil around the top of the piles was removed (which was not as easy as removing a whole area at once since the work needs to be done around installed piles).
After exposing the top of cast piles, workers demolished the concrete from the top parts with jackhammers, exposing the rebar, which was to be embedded in the pile cap that would come on top for a strong connection between the pile and pile cap.
Why they did not excavate the ground first, and position the rebar cage so that its top part was exposed in air, so they did not later have to do the delicate excavation around the pile heads, plus they did not have to remove the concrete at top of piles? Or is it that it can be done that way too? What are the advantages of each method?