Keyframes for Light or Materials disappear
What you describe is the way blender works. The only selected option is just more specific than you are expecting. For the keyframes of a value from a node to be displayed the node has to be selected in the node tree as well as the object using the material being selected. So when animating objects and armatures the only selected option works rather well but for animated node values it can just make life difficult.

When not using only selected, you have other filter options to help find what you are working on. The datablock filters let you show just nodes (you want both material and nodes for material nodes). Clicking the magnifying glass shows a text input that lets you filter by channel name, you can also use &#9096; CtrlF and type the search string or clear it out to remove the filter. There is also an option to sort alphabetically but you will find it works on the object names and not each channel name.