Portable power distribution box
You absolutely need breakers for the 5-20 and 6-20 receptacles - can't connect those directly to a 40A breaker with any hint of safety. And all the outputs would benefit from GFCI protection, given that you plan outside use; clearly required on the 5-20s and highly advisable on the other outlets.
So, you need a subpanel, at least.
Given a 50A input connector, &quot;your intended use with a 40A generator&quot; is moot - someone could plug this thing into a 50A receptacle, so your provisioning, wire size and protection scheme needs to be based on that case. If (common, but can't be assumed, has to be checked) your 50A devices have connections rated for 75°C you can wire them with 8 Ga copper or 6Ga aluminum and suitable wirenuts or Polaris connectors, or split nuts insulated with tape if you want to go old-school (you probably don't.)
Your 20A stuff, on the far side of the 20A breakers feeding it, can be 12Ga copper.
Depending on your choice of subpanel, you might be able to simply attach a few 4x4 boxes to it to hold the inlet and receptacles. Otherwise you'll end up mounting them all (subpanel and boxes for receptacles/inlet) to a suitable substrate, such as a hunk of plywood, or a plywood box. Size the plywood box right and your inlet cord will fit into it.