Swings and roundabouts
This is a shortened version of the fairground proverb, “what you lose on the swings, you’ll gain on the roundabouts” which first came into use during the early 20th century. A more modern version would be what goes around comes around.