Add #defines to reduce unnecessary includes from windows.h
Fix path_is_dir and path_exists on Windows (#9618)