Apple said the mini iPhones underperformed, but they were not some sort of commercial failure. They sold millions of units. Numbers most Android OEMs could only dream of for a single flagship model. Current day Apple is all about optimizing and determined that still wasn't enough, and I imagine the manufacturing for small, specialized display panels certainly took a chunk out of those margins, so Apple decided to pull the plug.
Myself and the people who said we wanted a smaller phone may be a vocal minority but we did buy the small phone when we were offered it. After I used the 12 mini for 2 years, I bought a 14 Pro since no mini was offered in the 14 generation, but I returned it a week later cause it was too big/heavy and bought a 13 mini. These days I'm using a 16 Pro since no mini is offered and the titanium did help a lot with the weight issue, but if they brought back mini phones I'd happily sacrifice the camera for a reasonably sized screen.