This has almost been a feature for Macs+iPhones for like a decade. You need to manually "pick a wifi network" but it'll turn on your phone's hotspot if you pick it from the list.
Never tried on my Mac, but on iPad, it’s totally automatic : the iPad automatically tells the iPhone to enable the hotspot (over Bluetooth I presume) then connects to it.