Apple built hardware, like many others manufacturers, and then used the app store, which is a glorified index with a locked gateway mechanism, to control which software get used on the hardware they sell.
They didn't build an ecosystem more than others, they just made sure to kill any potential competitive ecosystem on the same hardware.