If you build a wall downhill on a slope it will level terrain for itself, dragging the terrain up to meet it.
A foundation does not do quite the same thing. It keeps its top level and fills downward. Starting from a high point on the slope...
Depending on which way you drag the tool... starting from a low point on the hill - it seems to have been constrained to the same height as the first piece simply because that was there already. A foundation built further away will react independently to the landscape around it, and may well be at a different level.
Level the ground at the base of the cutaway.
You should be able to build a wall from the edge of the foundation now.
The reason for building walls above is to avoid the annoying "covered by floor tile" message. I haven't found out yet whether this is because of a bug, but it seems to occur sporadically. If you still get that message the best thing to do seems to be to undo a couple of steps and try again. Works for me!