A dangerous sex offender was caught by paedophile hunters 18 days after his release from prison for abducting a 15-year-old girl, a judge heard.