Some of this depends on how the train applies its brakes. Let's suppose the brake signal is sent from the track, simultaneously in the track frame, from a position on the track to the wheel directly above it. The brakes are perfect and go from $v$ to zero instantly.
In this case the short train enters the tunnel, and knowing it will hit the exit door, the track signal is pre-computed and sent simultaneously to the train. The train is 100% in the tunnel and finds itself at rest, crunched in its Lorentz contracted state by relativistic stresses.
From the train frame, the braking is not simultaneous. The front of the train stops 1st, with the rear well outside the tunnel. As the train slams into the tunnel, the braking signal works its way backwards and finally stops the caboose as it just enters the tunnel. The train is crunched by inertia forces.
Another option is that the train controls the brakes, and the conductor knows before hand, when to apply them to all the wheels, at the same time. (As in the track case, this has to be precomputed so that the braking events at different locations can happen simultaneously).
In the train frame, the front of the train hits the exit door and the conductor stops the entire train at once. Of course, the caboose is still well outside the tunnel when it stops, and the train finds itself stretched by relativistic stresses.
From the tunnel point of view, the caboose stops 1st and as the train is stretched by inertial forces, the braking 'wave' moves up the train, reaching the cab as it hits the exit door. The train has been stretched by inertial forces.
Those are the 2 extremes. You can also work out cases in which the cab or caboose control the braking, and the signal propagates along the train at the speed of light.
If the caboose sends the signal, and applies the brakes when it enters the tunnel, the signal cannot reach the front of the train before it has exited the tunnel.
If the cab applies the brakes, then it cannot stop the caboose before it enters the tunnel.
So the point here is if the train doesn't have brakes, it just slams into the exit door. The rigidity of the tunnel door doesn't matter because it has no longitudinal extent, nor does the rigidity of the tunnel: it is passive.
If you want the train to stop, you need to define how the brakes are applied, and since this is a thought experiment, engineering factors are not a concern: you can make the entire length of the train stop simultaneously, but it matters which frame you choose to define "simultaneous".
As we know from the Bell's Spaceship paradox, an object cannot accelerate uniformly with respect to an inertial frame without experiencing relativistic stress, and that is the case here.
If the brakes are simultaneous in the train frame, the train is stretched by $\gamma$ when it stops. If they are simultaneous in the tunnel frame, then it is crunched by a factor $\gamma$ when it stops, in which case, it fits in the tunnel.