He may have started getting defensive because he was worried about giving off the impression that he liked you too soon.
He wanted to play it cool but in the process ended up coming off as defensive.
He messaged you last night because he wanted to come clean about liking you.
However, you are dealing with a guy who has some insecurities when it comes to expressing his feelings and being open with them.
This means that his behavior could become more and more erratic as time goes on as he tries to keep himself in check when he should be allowing the process of interacting with you flow naturally.