In what kind of economic environment would the cliche of "keeping money under the mattress" be warranted? I'm trying to apply (ideally empirical-backed) economic theory to an age-old cliche.  

We must be very articulate about the assumptions, because if it's a total collapse of the dollar, then that money would just be as useful as tinder. Maybe it would be warranted if there was a run on the banks but the dollar still retained value. It's a difficult call though.

Question

What must we assume in terms of underlying economic conditions for someone with a giant pile of cash under their mattress to be favored over someone with their savings in a bank?
A fractional-reserve bank typically creates a lot of value by lending out your money to people while you are not using it. If you decide to take out your money on any given day, your dollar might not be there, but if not, someone else’s is! The bank will give you their dollar and wait for yours to come back from a loan.

However, during a bank run, many loans are going to default. So your dollar might not make it back, and if you’re not quick, you can’t take out someone else’s dollar cause they already got it back. Therefore your money could disappear.

No one can come into your house and take your dollar out from under your mattress though...