(The flight plans get passed between countries via AFTN/AMHS, which are dedicated telecommunications networks independent of the Internet.)
There's also several different ways to transmit the passenger manifest to CBP - including over a CBP-provided VPN and IATA "Type B" messages sent through ARINC/SITA.
The network for Type B messages is also independent of the Internet (it was developed 60 years ago).