A man who attacked a woman with a hammer just before she was hit and killed by a passing motorist has been described by a judge as a “man of very poor character”.