How can I paint rectangular sidewalks on terrain filled with a road material?

Details like that are usually mesh(es). Terrain is for (as the name says) terrain, not objects and man-made surfaces.
If you don’t want to do it yourself, take a look at the Easy Roads v2 or v3 EasyRoads3D v3 - the upcoming new road system (Part 1)