TLDR: You're correct, 40GbE is just cheaper.
40GbE is a dead end, technologically, and was done with "trickery" by bonding 4x10G channels into a single link - it wasn't really a separate speed type, like 1G vs. 10G is. But, it was faster and didn't have the drawbacks of port-channels, so it got used.
Then 25GbE, which actually IS a non-trickery, separate speed type, was introduced, and was able to use the same trickery to get 50GbE and 100GbE. Further, the optics were intentionally forwards compatible with planned 100GbE tech that was still in development at the time, and THAT could do the same bonding for 400GbE.
So basically 40GbE was a dead end street, tech-wise. Once everyone saw a viable, faster forward path (that was actually not significantly more expensive, either) they dumped 40GbE hard and the market was flooded. Whereas 10GbE trickled in and continues to do so, as it has its uses for access-layer aggregation instead of datacenter-only, which is where 25/50/100/400GbE really lives.