Usually, when CI fails, it's a flaky CI failure or that I have in fact not run it locally.
I guess some context is missing. My build flow seems much simpler. I check the CI steps overview and step log, and then I know what's wrong. That doesn't take 20 min. More like ~3 min.
At work, we use Jenkins and the runners are owned infrastructure. If I debug what goes wrong in the CI environment, I go into the pipeline definition, and do the calls locally, just like that, on the command line. No need for complicated environment replication beyond that. dotnet restore, dotnet build --no-restore, dotnet package --no-build, dotnet test --no-build, etc.
If it's not CI specific, issues show up in the normal local tooling without special env prep.