The Billiard Congress of America has a rule for a "jawed balls" situation:
3.33 JAWED BALLS
If two or more balls are locked between the jaws or sides of the pocket, with one or more suspended in air, the referee shall inspect the balls in position and follow this procedure: he shall visually (or physically if he desires) project each ball directly downward from its locked position; any ball that in his judgement would fall in the pocket if so moved directly downward is a pocketed ball, while any ball that would come to rest on the bed of the table is not pocketed. The balls are then placed according to the referee’s assessment, and play continues according to specific game rules as if no locking or jawing of balls had occurred.
This rule says "one or more suspended in air" though, so it doesn't exactly match my situation where the balls are still touching the table.
The International Billiards Association has a rule for a "jammed balls" situation:
j) Jammed Balls:
It is possible for two or more balls to
become clustered in the jaws of a pocket in such a way
that one or more of these balls would fall into the pocket
if the other balls were not preventing this. Any ball that
both players agree would otherwise fall into the pocket
should be placed in the pocket before the next stroke.
Based on this rule, the situation I described should have resulted in both balls being pocketed, since the center of each ball was over the pocket and not the table surface.