Private capital giant Apollo Global has agreed to buy a real estate investment group as it seeks to compete more aggressively with rivals including Blackstone, KKR and Brookfield.