Alphabet Inc. must lift restrictions that prevent developers from setting up rival marketplaces that compete with its Google Play Store, a judge ruled, upending the search giant’s dominance in the lucrative Android app market.