It’s both, really. After some misadventures in my youth, I have refused to engage romantically with anyone in an organization I’m employed by. “Don’t shit where you eat.” As I have moved up to supervise others, it goes doubly so for people within my chain of command. That would be highly unethical.
Essentially, one is practical advice and the other is a matter of ethics. If you follow the first, the ethics are easy.