WMG: The Crooked Man
There is more than one Crooked Man; everyone suffering from severe depression has a Crooked Man of their own.There is a note from an otherwise-unrelated man who killed himself in order to get away from...something. David also says that he's been hearing "voices" in his head, long before the Crooked Man started coming for him. The Crooked Man he keeps fighting is Duke's, but he's had one of his own for some time and it's part of the reason Duke decided to step in, figuring that David would know how to better handle his own when faced with someone else's. It's even possible that it was David's Crooked Man, not Duke's, whom Paul had to save David from on the hospital roof.
The Crooked Man isn't actually Duke's ghostThis is actually heavily implied by some of Paul's dialogue and several in-game documents. It's implied that The Crooked Man is some sort of pre-existing malevolent spirit that "imprinted" on Duke and later David, taking on elements of the former's appearance and personality due to his influence on it. The vision of David's mother in the hospital basement was likely the Crooked Man itself, or another spirit like it, taking on the form that would be most likely to drive David to suicide. Note that Paul and David, even when they know about the previous tenant and what happened to him, consistently describe the Crooked Man as if it's a separate entity or manifestation, not to mention the book in the hotel that describes entities that sound suspiciously like the Crooked Man, and the documents covering a patient who killed themselves to escape something sounding suspiciously like the Crooked Man... which then is implied to have gone after his doctor.
The game uses "The Sixth Sense" ghost logicNone of the ghosts seem to know they're dead, similar to the movie. It's possible when D says he's taken the bar exam five times, he's only actually taken it once in life, which is why he's failed the others. A majority of the ghosts in "The Sixth Sense" didn't realise they were dead, and would do the stuff they did in life. (Like maybe taking a bar exam?)