When a packet forwards to the destination address the next hop address is checked and corresponding to that next hop address a outgoing interface is selected where the packet actually moves. Let’s consider what happens when the routing table receives some prefixes with next hop looopback address of some router. In this case first a route lookup will be checked whether the destination prefix is in the routing table if yes then a lookup is performed for its next hop address becasue in this case next hop address is not directly connected interface. For latter, it will use the recursive lookup. This algorithm will work till it gets the directly connected interface. In most of the cases no recursive lookup will take more than 2 steps.
Actually it is more required in iBGP type of scenarios.