JPMorgan Chase & Co. Chief Executive James Dimon assembled a team in 2017 to answer a question that had been nagging at him for a while: “How should we think about Amazon?”

The team explored the ways Amazon.com Inc. could muscle into financial services and where JPMorgan could fit in, according to people familiar with the matter. And what if, as Wall Street has long feared, the tech company were to become a bank itself?