Unveiling the molecular gas composition in young protostellar systems with JWST/MIRI