As I understand that the loopback interface(127.0.0.1) is used to route packets back to the source. How is it then used to talk to iBGP neighbors? I understand that the goal is to ensure that the interface doesn't go down, so using an emulated/software interface ensures that, but how to packets go out of the host on a loopback interface. Thanks in advance.
A loopback interface on BGP speaking routers doesn't use only 127.0.0.1. It uses a routable address and can be used to reach a router regardless of what interface is used. This can be useful e.g. when configuring BGP sessions between two routers which have multiple paths between them, but you don't want to be specific on which interfaces are used.