A couple ways to handle the situation.
Have the second room of bandits roll for initiative and join the battle the round after they are alerted. Now with them in the turn order it makes perfect sense for them to ready actions.
Play it as just a normal initiative triggered when the door is opened, both sides are ready for action.
If one side in this case the bandits don't want to make their presence known they can try and stay quite and hide in ambush, while the fight in the adjoining room is going on. This could lead to surprise against the heroes when they open the door.
Personally I like the first option the best.
Good call.
All PCs can take 1 action per round. When no initiative is called or determined, spells and attacks and skill use requiring "1 action" still function, it's just the initiative order is indeterminate since it is moot. But in this case, it isn't. There is always some battle going on somewhere. The group of bandits in the other room, the second they hear the other combat, can decide to join the battle at that point and do nothing except ready actions for the door to open. This is what I would do and this is probably what the devs would say also, based on their previous rulings on similar topics where combat time or not combat time has come up.
As soon as you start taking actions (including ready action), you either have rolled initiative or are in a circumstance where initiative does not matter since you have plenty of time to delay or otherwise ready for a trigger. I know there's no delay initiative in 5th edition, but it amounts to the same thing in this case since the bandits are doing nothing in the other room except readying their crossbows and aiming at the door, and then waiting for it to open before pulling the trigger.
The actual rules question here is pretty clear, I think. Out of combat vs in combat is only differentiated by knowing ones' initiative. If you don't care about joining in combat before someone else, but rather wait for a trigger, you can retcon that initiative was rolled with no real difference. You can then make the other group of bandits roll at that point, or inherit the first bandit group's initiative, or do whatever you want. I know the DM is supposed to roll initiative for monsters joining in, but I would just house rule in that enemies who are waiting in the bushes always get the first reaction off, because their action is to react.
But delaying initiative to something across a closed door seems far fetched, so I'd probably just roll initiative right after the first set of arrows fly. Or before. No matter, those arrows are still the first things going through that door that just opened. That's what playing defense with some prep time allows you to do. I would of course rule the same way for PCs. They can ready actions even out of combat for a trigger, and lie in wait.