Without knowing their rate of warranty repairs, which are closely guarded secrets, we'll never know whether 5-7 year warranties are based on faith in the product to need a low level of repairs or whether the higher cost of repairs is balanced by increased sales due to public perception.
When I had my Hyundai Santa Fe, it had quite a lot of work done under the 5-year warranty, including engine/transmission rebuilt, but it was very clear that the workshop had little experience of each fault suggesting that most faults are uncommon and random.
Many cars get 10 year / 100,000 mile warranties in the USA - the market "demands" it and no doubt the manufacturers build warranty cost into the selling price.