You can delete foundation squares that have walls or fences on them, but not if there is anything else on them. Therefore you have to do a lot of moving items to delete a foundation. If you do delete the entire foundation, you have to raise the ground and/or use ConstrainFloorElevation false to re-level the walls to the ground. I've never had much luck with that cheat on large areas or finished buildings. I've only found it useful for correcting elevation glitches in small areas before the building gets too far along.
There is a reasonable work-around, though. You can delete enough foundation to place a stairway, then use one section of straight steps to go from floor to ground level. Create your basement, and add stairs from the short set. You'll end up with a longer than usual stairway to reach your basement, but you'll have a basement. You can place floor tiles over the lowest part of the basement stairs, so they won't take up much more room than the normal 4 tile length. Actually, you can place floor tiles over the entire lower stair, but it looks funny when sims walk through the floor to get to the basement.
Another work-around is to create a false basement by deleting inner foundation squares and using stair sections to lower terrain to normal wall height. It takes 4 stair sections to go from floor to floor. This method requires a lot of moving items to delete foundation under items.
For the attached garage, create a foundation for the garage walls then raise the terrain as high as it will go under the inside edge. This will be about one step down from the floor level. Level the ground inside the garage, add floor, and smooth terrain for the driveway slope. Add walls, garage door, & etc. OR create a carport with the front open and add stairs.
The only other option is to put all belongings in your inventory, and rebuild the house without the foundation. If you work in small sections you can clone wall coverings, floors, stairs,and fences.