Modern airports have highly advanced tracking systems, so they know exactly where the luggage with a short connection is located in the aircraft belly and it should be handled with higher priority.
However between theory and reality is a huge difference and not many airports have such systems in place...