Implement makedirs in file.managed.

Closes #10446.

Tagging @terminalmage for review here. I'm not sure what the purpose of checking for the makedirs function in the file module was originally, on the old lines 2730 and 2747.