When running the plugin to generate the sitemap.xml file. it generates the file after the contents of the public folder is copied into the dist folder.
This is because the plugin runs on the closeBundle hook.
If the buildStart hook is used, then the file will be included in the dist folder.
I have verified this solution.