LLDP is a link layer protocol used on switched at layer 2. Why do routers support it since routers work on layer 3?
You could ask why Windows, or MacOS, or linux supports LLDP. When you list the LLDP neighbors on your switch, where do you think it got that information?
LLDP has two parts: a sender, and a receiver. Devices that don't have an LLDP sending process will have nothing shown on the switch (an LLDP receiver.) Likewise, that device will know nothing of the switch if it doesn't have a receiving process -- and the switch a sender.
LLDP is a "Link Layer Discovery Protocol". The protocol advertises itself on links, and populates its own database from other senders. Routers and or switches (or even your home PC) can be connected to each other, and exchange LLDP information.
A router understands "layer 2" as well as "layer 3". Routers, as you probably know, speaks arp, which is a "layer 2" protocol.
A router will send a layer 2 frame with destination multicast mac-address
01:80:c2:00:00:0e. If a switch or router supporting LLDP receives a frame on it's port, with this destination it will be handled by the CPU. It will then let the LLDP process handle that information.
A 802.1D compliant bridge should not forward these frames destined for the LLDP multicast mac-address. LLDP is a great protocol to troubleshoot when you need to see who is connected to what port etc.