Legacy LaTeX is limited to sixteen math alphabets. I would strongly, strongly recommend that you port your code to unicode-math and LuaLaTeX if you can. The OpenType successor to fourier is fourier-otf.
Even if someone is forcing you to use PDFTeX, you might want to use isomath, which defines the alphabets \mathbfit, \mathsfbfit, and so on, and also allows you to load an upright, OML-encoded Utopia math alphabet with Greek letters as \mathrm and \mathbf.
Even if you don’t do that, I’d highly recommend using standard names like \mathbf and \mathbfsfit in your source, rather than \bm{\mathrm{x}}. You can still define them as \providecommand\mathbfsfit[1]{\boldsymbol{\mathsfit{#1}}} and so on. (It is preferable to use \boldsymbol in this context instead of \bm, as it takes up fewer math alphabets and is compatible with more packages.) Note that mathalpha defines bolder versions of many other math alphabets, including calligraphic and blackboard-bold, so you should use those if you load it.
The minimal fix for your MWE is to re-declare \mathrm and \mathbf as the mdput family (Math Design Utopia, compatible with the Utopia used by fourier) in the OML encoding, which supports Greek letters. I likewise define \mathsfit to use the math alphabet from sansmathfonts, which contains Greek.
When you set your math font to an encoding that supports Greek, you can use \mathrm{\alpha}, \mathbf{\beta} or \boldsymbol{\mathrm{\gamma}}, but I also define \upalpha and the rest for backward-compatibility with upgreek. (The fourier package has its own versions, but you had been using upgreek.) In order to be able to use \DeclareMathSymbol on them, I redefine \mathrm as an alias for the new upletters symbol font, saving a few math alphabets.
\documentclass{article}
\tracinglostchars=2
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fourier}
\usepackage{fontaxes}
\usepackage{amsmath, amsthm, amssymb}
\usepackage[bb=boondox, cal=boondox]{mathalpha}
\providecommand\bm[1]{\boldsymbol{#1}}
\let\mathbbold\mathbb
\AtBeginDocument{% thanks fourier
\let\mathbb\relax
\newcommand{\mathbb}[1]{\mathbbold{#1}}
}
\let\mathsfit\undef
\DeclareMathAlphabet{\mathsfit}{OML}{cmssm}{m}{it}
\SetMathAlphabet{\mathsfit}{bold}{OML}{cmssm}{b}{it}
\DeclareSymbolFont{upletters}{OML}{mdput}{m}{n}
\SetSymbolFont{upletters}{bold}{OML}{mdput}{b}{n}
\DeclareSymbolFontAlphabet{\mathrm}{upletters}
\DeclareMathAlphabet{\mathbf}{OML}{mdput}{b}{n}
\DeclareMathSymbol{\upGamma}{\mathalpha}{upletters}{"00}
\DeclareMathSymbol{\upDelta}{\mathalpha}{upletters}{"01}
\DeclareMathSymbol{\upTheta}{\mathalpha}{upletters}{"02}
\DeclareMathSymbol{\upLambda}{\mathalpha}{upletters}{"03}
\DeclareMathSymbol{\upXi}{\mathalpha}{upletters}{"04}
\DeclareMathSymbol{\upPi}{\mathalpha}{upletters}{"05}
\DeclareMathSymbol{\upSigma}{\mathalpha}{upletters}{"06}
\DeclareMathSymbol{\upUpsilon}{\mathalpha}{upletters}{"07}
\DeclareMathSymbol{\upPhi}{\mathalpha}{upletters}{"08}
\DeclareMathSymbol{\upPsi}{\mathalpha}{upletters}{"09}
\DeclareMathSymbol{\upOmega}{\mathalpha}{upletters}{"0A}
\DeclareMathSymbol{\upalpha}{\mathalpha}{upletters}{"0B}
\DeclareMathSymbol{\upbeta}{\mathalpha}{upletters}{"0C}
\DeclareMathSymbol{\upgamma}{\mathalpha}{upletters}{"0D}
\DeclareMathSymbol{\updelta}{\mathalpha}{upletters}{"0E}
\DeclareMathSymbol{\upepsilon}{\mathalpha}{upletters}{"0F}
\DeclareMathSymbol{\upzeta}{\mathalpha}{upletters}{"10}
\DeclareMathSymbol{\upeta}{\mathalpha}{upletters}{"11}
\DeclareMathSymbol{\uptheta}{\mathalpha}{upletters}{"12}
\DeclareMathSymbol{\upiota}{\mathalpha}{upletters}{"13}
\DeclareMathSymbol{\upkappa}{\mathalpha}{upletters}{"14}
\DeclareMathSymbol{\uplambda}{\mathalpha}{upletters}{"15}
\DeclareMathSymbol{\upmu}{\mathalpha}{upletters}{"16}
\DeclareMathSymbol{\upnu}{\mathalpha}{upletters}{"17}
\DeclareMathSymbol{\upxi}{\mathalpha}{upletters}{"18}
\DeclareMathSymbol{\uppi}{\mathalpha}{upletters}{"19}
\DeclareMathSymbol{\uprho}{\mathalpha}{upletters}{"1A}
\DeclareMathSymbol{\upsigma}{\mathalpha}{upletters}{"1B}
\DeclareMathSymbol{\uptau}{\mathalpha}{upletters}{"1C}
\DeclareMathSymbol{\upupsilon}{\mathalpha}{upletters}{"1D}
\DeclareMathSymbol{\upphi}{\mathalpha}{upletters}{"1E}
\DeclareMathSymbol{\upchi}{\mathalpha}{upletters}{"1F}
\DeclareMathSymbol{\uppsi}{\mathalpha}{upletters}{"20}
\DeclareMathSymbol{\upomega}{\mathalpha}{upletters}{"21}
\DeclareMathSymbol{\upvarepsilon}{\mathalpha}{upletters}{"22}
\DeclareMathSymbol{\upvartheta}{\mathalpha}{upletters}{"23}
\DeclareMathSymbol{\upvarpi}{\mathalpha}{upletters}{"24}
\DeclareMathSymbol{\upvarrho}{\mathalpha}{upletters}{"25}
\DeclareMathSymbol{\upvarsigma}{\mathalpha}{upletters}{"26}
\DeclareMathSymbol{\upvarphi}{\mathalpha}{upletters}{"27}
\usepackage{listings}
\input{literate.tex}
\pagestyle{empty}
\begin{document}
\lstinputlisting{literate_test.txt}
\end{document}

Once we redefine each math alphabet to cover Latin and Greek in both bold and regular weights, the document does not run out of math alphabets. If you genuinely need so many that this is impossible, the workaround is to display the math alphabets as text, for example \newcommand\mathsfit[1]{\textnormal{\sffamily\itshape\selectfont #1}}. You can also display a symbol that doesn’t vary according to the math alphabet or version with, e.g. \newcommand\QED{\mathord{\text{\usefont{LS1}{stix}{m}{n}\symbol{"D1}}}}. This does not use up a math alphabet.
Rather than load bm and nearly-disabling it by setting \bmmax to 0, I here redefine it as \boldsymbol. (Don’t do this in your source! Use meaningful names like \vectorsym and \tensorsym.)
There are also a few other tweaks, such as mathalpha for mathalfa, removing a few packages that I made redundant, and replacing fix-cm with fontaxes when you are not using Computer Modern.
unicode-mathfor this unless your publisher is forcing you not to. Otherwise, you might have a look atisomath, which defines\mathbfit,\mathsfbfit, etc. as alternatives to\bm{\mathrm}, and also lets you load an OML-encoded upright version of Utopia as your\mathrmfont. – Davislor Mar 15 '21 at 07:47