It's a materiality and advantage issue. If Red, the throwing side, put in 5 and Blue put in seven then both teams have options.
Red is required by law to comply with the numbers and drop two. If they don't, and Blue throw in, they may* be liable for sanction.
Blue has a choice: Throw in immediately and give up the chance for a FK or wait for Red to comply.
The referee's job is not to direct traffic but to adjudicate the outcome. If Blue get the ball away cleanly then advantage over and play on. If they don't then FK.
* 2018 law doesn't impose the FK if the throw is immediate.
2017 Law book
19.8(e) If the team throwing in the ball put fewer than the usual number of players in the lineout ,
their opponents must be given a reasonable time to move enough players out of the lineout
to satisfy this Law.
Sanction: Free Kick on the 15-metre line
So If "reasonable time" is not given you do not FK. That really is saying the same thing as
2018
Law 18 14.
Unless the throw is taken as soon as the lineout is formed, the non-throwing team may
not have more players (but may have fewer players) in the lineout than the throwing
team. Sanction: Free-kick.
If the throw is taken as soon as the LO is formed the non throwing side will not havebeen given "reasonable time" to remove players especially when sides arrive at the last minute.
Same intent, for me, stopping the "GOTCHA!".