Use of buses, as I understand it, is to get pax to correct arrival area for domestic or international arrivals....or for the "pushback" stands. Generally speaking the airport tries to arrange domestic flights to park on "domestic stands" (those with access to domestic arrivals hall) and international flights to "international stands" (those with access to international arrivals hall).
Sometimes though it's not possible to do that - due to limited number of stands available - e.g. outbounds with slots, ramp congestion, etc, etc) so the inbounds are given next available so as not to hold for a stand that is currently occupied.
That is a pretty simplistic overview but fits the basic principle.
Re: border control, I really don't have enough knowledge on that front to comment.
I'd suggest you had an unlucky day - every agency involved really does want to "process" the pax as quickly & efficiently as possible