I have actually done this so let me give you some real world observations.
If it's a metal roof RUN SCREAMING FROM FOAM INSULATION!!
If you have a layer of tyvek already in place what is to hold the foam up? The tyvek definitely won't support it and with the tyvek in place it can't adhere itself to the metal.
Now think about the metal building type of metal roof. It doesn't have a lot of overlap and the guys who install it use the self drilling type of screws. How many times have you used those type of screws and found that after it drilled through the first layer it raised that layer up before completing the drilling through the second layer leaving you with a gap there? Tons right?
Do you really think those guys are being super careful to make sure that never happens?
Those screws have a rubbery washer on the head to kind of seal them so another fail point is that they don't screw it in tight enough or they screw it in too tight and bust it.
And then there's time. Father time, although I think it ought to be Mother time because time is an absolute MOTHER, causes those washers to crack and shrink which means what's sealed today isn't tomorrow.
So let's recap.
You have limited overlap.
Lots of areas with large cracks between the material.
Many washers not sealing from the get go &
Washers failing with time.
That means you get leaks. Lots more than with a traditional roof or a metal roof designed for a residential home.
So now lets look at the foam. While this is very simplistic there are 2 basic types of foam you will get installed in your building. Soft foam and hard foam.
Soft foam is the most prevalent by far. Soft foam will hold the moisture, hard foam won't.
So the soft foam gets wet, stays wet and if you have a wood decking it will rot it. Also it will let loose after time and suddenly you will have a large section falling down on your head.
The saving grace in a home is that traditional wood decking with asphalt shingles doesn't leak often or as much as a metal roof so it works in a home, but is a fail point in a metal building.
All of the above I've seen happen with my own eyes.
Back to cellulose vs. fiberglass. Cellulose is powdered paper and what happens when it gets wet? It clumps, stays wet a long time and causes rotting and stains. I love cellulose and have it in my house, but in this case fiberglass is the best because METAL BUILDING ROOFS LEAK! I go up every other year to caulk, tighten screws & replace screws on my metal building and I still get leaks.
Foam tends to be alright on the walls because there's not as much moister there &/or it can run downwards and the foam doesn't separate from the walls.