Maybe.
Magura strongly suggests using their "Royal Blood" brake fluid, whereas Shimano specifies Mineral Oil.
My understanding is that Magura's fluid is a variation of Mineral Oil but they're not identical. Mixing fluids is generally a bad idea, as is using a part designed for DOT brake fluid.
Another point to consider is the stroke and bore of the cylinder vs what the calipers expect. A mismatch may result in a high lever movement for little pad movement, or the opposite.
So the answer is "maybe" and depends on your risk acceptance. Given these are brake parts, I'd be quite conservative and cautious.
One option might be to put the working Magura lever on the front brake which is the most useful, and explore using a Shimano lever for the rear Magura brake.
If it doesn't work, you have to replace the lever and flush the whole system clean anyway.