If a fish can fit, it can be kept alive with constant water changes and feeding in a fairly small container. “Quality of life” issues, “humanitarian confinement” issues, can all be factored in so the number of inched per gallon doesn’t necessarily define all the parameters necessary to give one simple answer to this question.
I’ve heard of inStances where fish were lodged in a bathtub for emergencies and this setup is better than just flushing the fish after a tank failure or prolonged power outage, but long tterm planning for housing fish is hopefully more well thought out and conservative in stocking densities to allow for more of a safety cushion for challenges that may later.