I’m trying to understand why I have to put the verb in the past here if this means “It’d be better to go home”. What if I wanted to say “It was better to go home” ? 帰ったほうがよかった ？
Yes, you can say that, although I think 帰ればよかった would be more commonly used. (I’m assuming with your example sentence you’re expressing regret about a past action.)
It was better to go home would be fine as what he said. 帰ればよかった is I should have gone home.
The verb is not actually in the past tense here. That is to say, it’s not referring to a past action, which you noticed. This is actually called “perfect aspect”. It refers to a completed action, regardless of when it is completed. This might also help you understand other uses of た that seem to be out of place with the usual explanation of it being “just past tense.”