Is there a way to have a MachineFunctionPass as a analysis dependency for ModulePass using legacy PM?

I am trying to do a dependency on MachineLoopInfo analysis in a ModulePass. I know that it’s OK to have dependencies of FunctionPass in a ModulePass. So if MachineFunctionPass is a FunctionPass, I assume it to work too. However, there is a trouble with that. As far as I could understand, legacy PassManager uses so-called ‘on-the-fly’ managers to invoke analysis passes lazyly when MP->FP/MFP dependency is encountered. Those managers are decoupled from main stack so MachineModuleInfoWrapperPass that’s used by all MachineFunctionPasses is unavailable. Then decoupled pass managers tries to create its own MachineModuleInfoWrapperPass and eventually fails because default constructor for that pass initializes TargetMachine as null.

I am seeking help in finding out if I missing something here. I failed to find an example of such dependency in llvm codebase, so I wonder if it even possible.