How should I handle packages that hard-code an unavailable locale?

The default Pipenv package builds successfully—

$ nix-shell --pure --packages 'pipenv' --run 'python --version'
Python 3.8.11

—but when I set the Python version it fails with an error about locales:

$ nix-shell --pure --packages 'pipenv.override { python3 = python36; }' --run 'python --version'
RuntimeError: Click will abort further execution because Python 3
was configured to use ASCII as encoding for the environment.

This system supports the C.UTF-8 locale which is recommended. You
might be able to resolve your issue by exporting the following
environment variables:

    export LC_ALL=C.UTF-8
    export LANG=C.UTF-8

Click discovered that you exported a UTF-8 locale but the locale
system could not pick up from it because it does not exist. The
exported locale is 'en_US.UTF-8' but it is not supported

I noticed that the problematic locale is hard-coded in the package—

LC_ALL = "en_US.UTF-8";

—so I tried removing that and it built successfully:

$ nix-shell --pure --packages '(pipenv.override { python3 = python36; }).overrideAttrs (attrs: { LC_ALL = null; })' --run 'python --version'
Python 3.6.14

I’m still new to Nix and don’t know how to interpret this. Am I using the Pipenv package incorrectly? Is this a bug in the package? A mistake in my system configuration? Or is this all just expected and I should carry on with this approach?