Folder changed into document
There are a bunch of posts online from users who have run into this issue. All of them end with the same answer: "I hope you have a backup." 

I have spoken to multiple people who have worked with Unix/Linux for a long, long time. The general consensus is that 


there is no way to just "turn a folder into a file"  
there is no recovering from whatever you have done without restoring the
directory from a backup


They believe that some application has deleted the directory unintentionally and replaced it with a file. I have looked online for a way to manually set the d bit of the file you are speaking of but there seems to be no way of achieving this.

So, my answer is to restore the directory from a Time Machine backup (you hinted that you already had a backup - use it).