Implement makedirs in file.managed.

UPDATE:

This is now ready for merge. Thanks to @terminalmage for amazing work here!
--

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.