The dynamic conda.yaml generation trick doesn't actually fix this, and you already found that out yourself. Whatever ends up in the final logged conda.yaml is what gets read at environment build time, so if a plaintext credential has to be in that file for pip to authenticate, it's in there for good, no matter how it got written.
The way to actually avoid this is to stop putting credentials in the model's conda.yaml at all, and instead configure a workspace-level default package repository. Under Settings, Compute tab, there's a "Default Package Repositories" section where an admin can set an index-url or extra-index-url pointing at your private repo, and the credentials for that live in a Databricks secret scope on the admin side, not in any individual model's dependency file. Once that's set up, your model's conda.yaml just needs mypackage==1.2.3, no username, no token, no full URL. Databricks documents that Model Serving picks up this workspace-level repo config automatically when it builds the model's environment, so you're not doing anything special per model, it just resolves against the authenticated index behind the scenes.
For Froffri's case with an Artifactory PyPI mirror, that's a clean fit since Artifactory is already speaking the PyPI index protocol, you just point the workspace default repo at it.
For the original git+https install off Azure DevOps though, that one's trickier, because the workspace default repo setting is documented for pip index-style repositories, not raw git URLs. There isn't a supported way to strip credentials out of a git+https://user:token@... line the way there is for an index URL. The cleanest path there is to stop installing directly from the git repo and instead publish the internal package to a proper package feed, Azure Artifacts supports a PyPI-format feed for exactly this, and then treat it the same way as the Artifactory case above. That gets you back to a plain mypackage==1.2.3 line with zero embedded secrets.
One dead end worth mentioning so you don't burn time on it: pip does support ${VAR} environment variable expansion in requirements files for index URLs, so in theory you could write --extra-index-url https://${USER}:${TOKEN}@repo/simple/ and keep the literal token out of the file. But Databricks Model Serving's secret-backed environment variables are only injected at inference runtime, after the environment is already built and dependencies are already installed, so there's no env variable available yet at the point pip actually needs it. That trick works for a local pip install but not for how Model Serving builds the container.