How to get parent material from dynamic material instance if parent is material instance?

Answer is in the opening post