Skip file path validation in CreateEpContextModel when the output is not a file (#28431)
### Description
A file output path is needed when:
- Writing the output model to a file (not to a buffer or write function)
- Writing initializers to an external file (needs the model path to
compute the external file location)
otherwise the file output path validation can be skipped.
### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->
When compiling a model via the Compile API in a sandboxed environment,
CreateEpContextModel() would attempt to validate/generate a file output
path, even when the user explicitly set the output to a buffer via
SetOutputModelBuffer(). This caused std::filesystem::exists() to throw
an "Access is denied" exception on the dummy model path
_MODEL_EDITOR_API_MODEL_, because the sandbox restricts filesystem
access.