Artillery and mortars where hardly limited to attacking or defending. Sweeping up after an overwhelming artillery barrage presupposes the attackers having artillery supremacy. In a true stalemate both sides just get hammered by artillery with neither receiving a net advantage while both rack up casualties.
As to a gun armed mob, it really depends on how capable they are. A defensive position is of limited value vs a well trained sniper using even a simple hunting rifle. The basic issue is it’s difficult to actually defend yourself without also exposing yourself. This is further degraded when talking about a single defender who can’t benefit from overlapping fields of fire etc.
Our hypothetical survivalist would benefit from training, but they don’t receive the primary benefit that keeps modern military casualties low, access to trained and well supplied medical personnel.
The same applies in modern warzones, what works as a defensive position against a gun-armed mob doesn't necessarily work against infantry with military weapons including mortars and grenade launchers, and vice versa - if you know your opponents don't have proper equipment, you can effectively make deadly defensive positions which modern militaries wouldn't be able to use against their opponents.