Connecting both consoles to a router with a LAN cable will work, but it can also be done with a single LAN cable by connecting the consoles directly to each other. This can be done wirelessly by getting the PlayStations on the same Wi-Fi network, or through a LAN cable. The transfer requires the two consoles to be connected to the same internet connection in one way or another. Sony would likely agree with this sentiment since it doesn't provide a button prompt on the screen to cancel while the transfer is active. Strictly speaking, it is possible to cancel the initial save data transfer from a PS4 to a PS5, but it's not recommended.
Choosing to transfer save data can be a lengthy process, and sometimes the transfer gets stuck, leaving many to wonder if it's possible to cancel the transfer. Luckily, for those coming to a PS5 from a PS4, the new console will display a prompt asking about save data transfer during its initial setup. This is especially true for players attached to accounts they've been using for a while, like a PSN profile. Early adoption of a new console generation like the PlayStation 5 can be a confusing process with a lot of questions.