As a replacement for 9 volt alkaline NiMH is okay, but the ones I've tried have pretty low capacity. Li-ion is much closer to alkaline for actual run time.
Yeah no argument there, I've found NiMH to be adequate for my DMMs though, they last a fairly long time either way.
I recently opened a piece of test gear that runs on 4 D size Duracell Alkalines. It had not been switched on for at least 10 years. The cells had use by date 2002. They had not leaked at all, even though they were flat.
The D cells seem to be quite robust. When we were cleaning out my partner's grandfather's place after he passed away I found a Pay n Save bag from the 80s with a package of Energizer D cells from the 80s that were leaking but that's the only time I can recall seeing D size alkalines leak. I haven't seen many C cells leak either, the AA's are the worst by a long shot, followed by AAA.
I wish the D cells in my Maglites knew they didn't leak. I suspect there are two reasons you haven't seen as many leaking D cells. First, there are far fewer of them used. I probably have ten to twenty pieces of equipment using AA or AAA for every one that uses D size. Secondly, that equipment tends not to put a parasitic load on the batteries. It is off, not on standby. As noted previously, batteries are far more likely to leak when drained flat.
I have the impression that D cells leak less as well but, as CatalinaWOW mentioned, it may be a numbers game. However, the D cells on my flashlights take much more abuse than the pampered AAs or AAAs, with the bent top notches due to the stress from the flashlights springs and the mechanical hits that naturally happen with them (my twin 5 year olds love to play with them, with the occasional bump and fall).
To me, AAs and AAAs equally leak.
A large part of it probably is numbers, I haven't done extensive testing. About the only thing I use D batteries in are the virtual walls for my Roomba, they last quite a long time and are eventually drained completely flat.