You are spot on in recognizing that onycholysis is the separation of the nail from the nailbed.
There are many causes of onycholysis. Trauma is the most common cause. Other common causes include fungal infection (onychomycosis) and nail psoriasis. Sometimes, it can be related to a growth in the nailbed.
It generally takes about 6 to 9 months for a complete fingernail to grow out. If your onycholysis has persisted for so long, it would be good to get it reviewed to ascertain and treat the underlying cause.
Dermatologists treat skin, hair and nail diseases so you can consult a dermatologist for your problem.