How does router transmit RIP messages to other routers? RIP uses UDP (transport layer protocol) to transmit messages and routers don't operate at transport layer.
The routing task (receive packets and forward them) is a layer 3 task.
A router in its basic features is a layer 3 device because it only checks the content at layer 3 (
source IP / destination IP).
It doesn't mean that the device is unable to use or check upper layer protocols. For example in a router you can put a filter of TCP ports to block the access to HTTP, FTP, etc.
The router can use a higher layer protocol to send / receive information to/from other routers (RIP, OSPF, etc.)
In addition a router is a host. it can be reached via SSH / telnet or upgraded via FTP /SFTP.
Router can and do use the transport layer for various tasks.
For example to manage the router you usually connect to it via SSH which use TCP.
So, to forward a packet from a network to another, the router doesn't need to care about the content of the packet, but that doesn't mean it isn't capable of.
Actually, most router embed some security features like access lists that do inspect the content of the packet, like the TCP destination port, to allow or the communication or block it.
simply you can think in RIP as an application has its own control plane (some thing making it up and run, like recognizing its RIP neighbors ) and has its responsibility plane (which is updating routing table from its RIP neighbors ), so its control plane Not necessary to be operate in its responsibility plane which is Layer 3 responsibility
regardless the router as a layer 3 device it can also filter packet based on TCP or UDP ports, some routers have impeded security feature as well. you can think in router as a PC has its own processor and memory and I/O interfaces. run what ever protocol based on ISO suite.
please make use of this conversation RIP - Layer 3 Protocol or An Application
You should recognize between Data plane and control plane , control plane have many functions one of them is exchange the routing information with the other routers using routing protocols like RIP , but data plane is used for transmitting the transit traffic using what was learned or configured on control plane .
The router control plane work on all layers but transmitting the traffic are based on up to network layer only on the standard L3 router