And if you set MariaDB to not have Internet connectivity, it attempts to accomplish this by setting the TCP port to 0. Ostensibly because it's not supposed to be a valid TCP port, except it actually is on thousands and thousands of systems.
So I don't know if the check you're referencing is evaluated when someone sets their instance of MariaDB to "not" be internet accessible.