The plastic shim the the gap in the cranks has a thin metal pin which goes in a hole in the axle, this is so you know the arm is located correctly, it is not strong enough to hold a loose crank on, it just bends.
The plastic pre-load cap that threads in the end of the axle is just that, for bearing pre-load. Its a bit more substantial and may help hold a loose crank on, but thats not its job, it will break eventually and your loose crank will fall off.
You problem is your crank is loose. It was probably ridden loose and didnt fall off straight away (due to things pointed out above) so you probably damaged the splines. Next time you re-fitted it the damaged splines didnt fold so bolts had to be tighter, deforming crank more, ergo, it falls off again. Repeat.
All of this is of no importance tho. your crank is done, throw it away and buy another. If the axel is ok you may be able to save a bit of money just buying a non-drive arm, but full chainsets are so cheap its prob not worth it.