You can try using Stroke (outer) Blending Option of Photoshop, for text layer.
Type your text. Apply Stroke (outside) from Blending options. May need to tweak settings of stroke to give you sharp stroke. Size should be as much as spacing you need
While the text layer is selected, go to Layer menu on top menu bar > Layer > Layer Style > Create Layer. This will give you the outer Stroke as a separate layer
Again, duplicate the newly created style layer (hide the unnecessary layers). Apply an outer stroke again, but this time the stroke weight should be according to the weight of the outline you need
Set the Fill to 0% of this layer
Convert the layer to Smart Object and then rasterize it (Right click > Rasterize)
You'll get the outline.
You may need to mask the unwanted marks and fix the path little bit using brush or a suitable tool.
Later you can move your text inside this outline.