This sounds like a great idea, really. To make it work, first, the dwarves should carry the dirt in buckets instead of bags (it just makes more sense, really, and gives buckets more of a purpose). Also, the dirt should not be stored like sand; it should be collected from "dirt collection" activity zones and immediately hauled to its destination.
There should also be a new construction type, "dirt mounds," to solve the problem of dropping entire tiles of dirt on enemies at once. The way it would work is this: one bucket of dirt creates a mound, which blocks the movement of smaller creatures but not larger ones (and allows trapped creatures to escape from it if given enough time), and another bucket creates a wall. Dirt mounds adjacent to walls automatically become ramps, and pouring dirt on a one-tile-wide area will create dirt ramps to the sides, which will (realistically) prevent you from building a 3-tile-high dirt wall without it piling up into a mound.
This allows you to create super-fast makeshift fortifications out of dirt if you only need to keep out smaller enemies like macaques or kobolds, and it makes it difficult (but not impossible) to bury enemies in dirt. Also, areas of dirt that are dug up (and perhaps areas of sand that are collected from glass) should be mined out and replaced with dirt mounds, and then a subsequent dirt/sand collection should replace the mound with empty space. Getting dirt and sand from nothing just doesn't make a lot of sense; if you're going to move enough dirt to dam a river, it has to come from somewhere. Dirt mounds should be removable with the Remove up Stairs/Ramps command, so that you can bury something like a floor hatch in dirt, and then remove the mound, leaving a dirt floor that conceals the hatch.
It might also be nice to make dwarves bury the dead in graveyard designations by using this feature. It seems strange for dwarves to leave the dead lying in the open to rot.