In my case, I duplicated the previous target. It is considering the previous targets .entitlements file for new one too and New entitlements file is not created automatically. Then i went to Build settings - Signing - Code signing entitlements and removed the filename.
It makes your target to clear some capabilities. I added the required capabilities again. As soon as i added the capabilities, new .entitlements file is created at the root level of my project.