Just because there is a default doesn't mean you cannot store the key as a user secret for example. It is even questionable whether it is a secret at all. If the key is compromised the only risk is that it is used to send additional telemetry. It can't be used for reading telemetry.
That said, you can alter the configuration:
If you want to store the instrumentation key in ASP.NET Core user secrets or retrieve it from another configuration provider, you can use the overload with a Microsoft.Extensions.Configuration.IConfiguration parameter. For example, services.AddApplicationInsightsTelemetry(Configuration);. Starting from Microsoft.ApplicationInsights.AspNetCore version 2.15.0, calling services.AddApplicationInsightsTelemetry() will automatically read the instrumentation key from Microsoft.Extensions.Configuration.IConfiguration of the application. There is no need to explicitly provide the IConfiguration.
(source)
Also, from the same docs, environment variables will do as well:
An instrumentation key specified in code wins over the environment variable APPINSIGHTS_INSTRUMENTATIONKEY, which wins over other options.