The penalties are applied all at once. So Bottas got +3 and Max got +5 which is 6th and 7th respectively. THEN the rest of the grid gets moved up.
I assume, in the case two drivers end up "sharing" a grid slot, the positions are decided on the order of the infractions.