Math and science picked Python because NumPy, SciPy, and pandas gave them a decent glue layer over C and Fortran, and once the papers, notebooks, and teaching material piled up, the lock-in was social as much as technical. MATLAB being awful helped, but only at the margin.
venv and Docker don't fix much. They just freeze the mess until rebuild day, when you find out half the stack depended on an old wheel, a dead maintainer, or a C extension that no longer compiles on a current Python.