API 26+: WRITE_EXTERNAL_STORAGE permission is always denied
Somewhere along the line, you are picking up that android:maxSdkVersion="18"
attribute. My guess is that it is coming from a library. Check the "Merged Manifest" tab in Android Studio, when you are editing your own manifest. It will have details of what is contributing the various elements and attributes.
android:maxSdkVersion
has the effect of removing your <uses-permission>
element on higher Android SDK versions, at least in terms of how runtime permissions work.
Since you need this permission for all versions, adding tools:remove="android:maxSdkVersion"
on the <uses-permission>
element should revert the android:maxSdkVersion="18"
and give you what you expect.