BGP why do we need an IGP for BGP to work
When learning about BGP the fact that an Interior Gateway Protocol (IGP) or static routing is needed to make sure BGP functions correctly can be confusing.
In a typical BGP implementation scenario, it must be made clear that BGP is not responsible for the routing found within an AS. BGP shares prefixes between iBGP routers within an AS, not for the purpose of internal routing, but in order to share them with other ASes.
For this reason, the routing within an AS must be achieved using an IGP or static routing. And it must be employed in such a way so that all iBGP routers within the AS can reach each other, to establish full mesh iBGP peering. Remember iBGP peers don't have to be directly connected.
So iBGP collects the prefixes that are internal to the AS for the purpose of sharing them via eBGP with other ASes.
Links
https://networklessons.com/bgp/internal-bgp-border-gateway-protocol-explained/