Why do people need state’s consent before loving someone?

When you are a child you are taught how to differentiate between genders, you are not taught to see the person as a person but as a girl or a boy.