They did. We know how they were built.
Teams of farm workers worked under trained foremen during the annual inundation of the Nile, when the fields were flooded. Blocks of stone were floated up from the Nile close to the pyramids on barges on purpose-built canals – bearing in mind that they’re really close to the river.

The river is in the middle distance, among the buildings. Here they are looking the other way, from across the NIle:

So you can see the blocks, and the canals, didn’t have to travel far.
Once the blocks reached the site, each pyramid was built with a spiral stone ramp running round it in a groove. The blocks were slid up the ramp, building the pyramid higher and higher, then when it was full height and they’d put the capstone on, they backfilled the ramp and its groove from the top back down to the base.