Loss of top line can result from a variety of things. Poor conditioning, pain, a lack of protein in the diet, IR problems/cushings, sometimes cribbing can contribute....
If he has been a beginner lesson horse he may have been ridden 'inverted' a lot, causing poor muscle development..
Check his teeth, diet, and build his muscles with hill work if possible and trot poles, where he is encouraged to lift his back and use his muscles properly. A good body work person can be valuable as well to see if there is a pain issue.
At 23 and having raced a lot, all the stars are likely going to have to align to build a top line on him.