There is indeed such a system installed at some airports. It is called an engineered materials arrestor system (EMAS). Incidents such as Southwest 1248 have shown the potential safety issues of runway overruns, as you have pointed out. The EMAS solution uses a pad of special material at the end of the runway, designed to allow landing gear to sink into the material. The landing gear is not ripped off, but as the gear travels through the material, the plane is slowed down.
Destroying the gear is not a desirable option. Although the gear on airliners is designed to safely separate from the aircraft, there is still the potential for damaging fuel tanks or other structure. The aircraft will also be even less controllable after the loss of landing gear. If a small aircraft is not going very fast, a small wall could cause it to flip over, worsening the situation.
In the crash you referenced, the aircraft was traveling very fast at the end of the runway, and an EMAS may not have been sufficient to stop the plane. An EMAS typically has a max entry speed of 70 knots, so in incidents like the one linked from the question, this kind of system may not completely prevent a fatal incident. Since the aircraft's gear must break through the material, lighter aircraft may not be stopped as effectively. However, small aircraft have been stopped with such a system.
The FAA is looking at places where these systems could be useful, with a focus on runways that cannot have the recommended 1,000 foot safety area at the end. The runway safety area (RSA) is the best option for a safety buffer at the end of a runway, providing extra distance for an aircraft to stop. The article above notes that the EMAS at Burbank airport took $4 million to install, and that is a fairly small airport that doesn't usually see anything larger than a 737. Any overrun will incur certain recovery costs, but an EMAS will need to be repaired after any overrun or accidental damage, possibly closing the runway, and will be less effective until repairs are completed. Airports must weigh all of their options for providing a safe facility.