Amazon, the store. the store that sells stuff at “unbeatable” prices and has convenient fast shipping options. exists because Amazon, the corporation, makes most of its money through platforms that are NOT the store.
They were also famously unprofitable for a very long time, longer than most businesses would consider reasonable. They were founded in 1994 and it took until 2003 to make a profit. They were investing a lot of money back into the business.
AWS didn’t exist until after Amazon became profitable. They were already making good long-term decisions before AWS.