Are there any applications in which a Nyloc nut is preferred to a proper cap nut?


As best I can tell: a Nyloc nut is just a specialized cap nut that will fail under lower torque and temperatures than a metal cap nut.
Not all cap nuts are self locking, some are, although they can be a bit weird looking.
Nylocs are generally the first choice for general use as they provide good resistance to loosening due to vibration or flexing of the joint and will stay in position on a thread even when not under tension (unlike spring washers). Unlike locking adhesives they can be removed and adjusted without losing their locking properties and can, to some extent be reused.
There are certainly many alternative types of lock-nut which may be preferred for specific applications for example structural applications may use washers which bite into the joint, there are a whole variety of thread sealing adhesives, spring and star washers have applications and you can also get nuts with asymmetric threads which exert a radial load on the thread. all of these have their various advantages but nylocs are pretty ubiquitous for general use whre you just want something chap simple and reliable.
So typically they would be used for general engineering assemblies which aren't economical to analyse in exhaustive detail and need to be made to a price. Obviously for high temperature applications nylocs aren't suitable but that is usually reasonably obvious.
Cap nuts are generally used to prevent having an exposed thread protruding on the nut side of the joint this generally looks neater, reduces the risk of snagging and can help prevent the nut from seizing due to corrosion.
The major downside of cap nuts is that the bolt or stud needs to be within a few mm of the exact length required and there are a number of applications where they cannot be used eg if you need a nut some way along the length of a stud or need a reasonable range of adjustment. Also if you get the bolt length wrong you can end up with an apparently tight nut which isn't exerting the expected compression on the joint.
A Nyloc nut is a form of locknut. The purpose is to prevent unintended loosening.
A cap nut is not necessarily a locknut. You can get cap nuts that have some form of locknut on the threads; but in general this is not a standard feature of all cap nuts.