How does the frontend funnel requests to a particular flex package in the backend when a new endpoint is added?

The customized endpoint already exists in an extended/customized library component, which is part of a flexPackage (depends on your manifest configuration). The fact that you extended that endpoint does not alter the gateway routing to the appropriate flexPackage.

As for the routing itself, this is informed via configuration. During project generation (e.g. mvn flex:generate), the config directory is created. Inside this, the insecure/gateway-local.yml config file is generated. The contents of this file describes the routing for a given bounded context. This is consumed by Spring Cloud Config. The gateway instance (which is Spring Cloud Gateway) subscribes to the Spring Cloud Config instance for routing configuration. These links can be helpful too:

Broadleaf Dev Central.