the cantrip Mold Earth states:
If you target an area of loose earth, you can instantaneously excavate it, move it along the ground, and deposit it up to 5 feet away. This movement doesn’t have enough force to cause damage.
so the question is if the following graphics are accurate with the assumption that the ground is entirely loose earth
| | | | XXXXXXXXXXXOOOOXXXXXXXXXXXXX XXXXXXXXXXXOOOOXXXXXXXXXXXXX XXXXXXXXXXXOOOOXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXX
move it 3 feet up
| |_________OOOO |_________OOOO |_________OOOO XXXXXXXXXXX____XXXXXXXXXXXXXX XXXXXXXXXXX__^_XXXXXXXXXXXXXX XXXXXXXXXXX__|_XXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
and then 2 feet over
| |____OOOO |____OOOO <- |____OOOO XXXXXXXXXX_____XXXXXXXXXXXXX XXXXXXXXXX_____XXXXXXXXXXXXX XXXXXXXXXX_____XXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXX
(where the Xs and Os are 1/2 a foot wide and each row is 1 foot deep)
so if a humanoid were to stand in the 3 foot deep hole behind the 3 foot high cover that is two feet thick (and most likely 5 feet wide), how much protection would this provide for them? Does it seem reasonable that a PC would be able to erect such a barricade in combat or would it have to be done prior to combat?
Not as much protection as you'd think.
Try this at home - get a shovel, and try to pile "loose earth" into the shape you've described (3ft tall, 2ft deep wall). It will immediately fall down into a pile. The angle of repose of soil is 30-45 degrees. In your configuration (2ft diameter base) the pile needs to have an angle of repose of 75 degrees. So the entire thing flops over to about half its height. The soil from the sides of the hole is also falling inwards, filling up your hole, probably reducing the amount of cover from the hole by half as well. If you're unlucky, the soil from the wall will fall backwards into your hole and reduce the depth even further. It would look more like this:
If you're lucky, you'll get 3 feet of cover (partial cover) out of this. There's a reason soldiers build trenches out of packed, not loose, soil.