How can you replace a terrain with another across all sources?

so i’m trying to change open_air tiles on roof tops to sand or some other form of solid matter across all structures so I don’t get any of this stuff:

However i’m trying to figure out I would fill in those areas with solid traversable matter like sand. Is there any way I can transform that terrain at the source?
For that matter how I change any other type of terrain to act like another, such as transforming all sidewalks to become “solid_earth”