I am not sure if "fire code" explanation holds true ss i have never seen anyone anywhere actually producing such code but i've encountered hotels offering same rooms for higher occupancy for extra payment.
That being said note that 2 beds in many places in europe and asia means two twin beds (and king are same beds moved together) and many rooms are too small to fit anything extra. Couches are often not fold out kind but just small sitting only type. Some places are much more by the book than others - i would advise against trying to sneak in extra ppl in japan for example.
No issues in north america or wherever you can book 4 outright. For others i would recommend emailing hotels to clarify (and second room for discounted rate is quite common overseas and really helps with sanity ime

) .
It will get even tougher as kids grow older..