Looks like it was never glued. Worst case use a rubber coupling with hose clamps. Makes a simple, easy and resilient fix. My shower drain loosened once, my weight flexes it. I tightened nut and put rubber coupling over assembly, 18 months no more issues.
These things all flex going down road. I check all easy to reach plumbing connectors quarterly, like sink strainer nuts etc.
__________________
|