MUMBAI—India’s ubiquitous mom-and-pop stores are being weaponized in e-commerce wars, as Walmart Inc. and Amazon.com Inc. square off against India’s richest man in the country’s nascent online retail market.

The millions of tiny stores and stands across the country have proven tough to beat for e-commerce giants and supermarket chains looking to capture a slice of the spending of India’s middle class.

Almost...