When I think of the rules against attachment. I think of Obi-wan.
Anakin got something right when he said Jedi were in a sense encouraged to love. Compassion for other people, wanting to protect them.
And what we see of Obi-Wan bears this out. He outright says, he loved Anakin. There's no question of that. He raised him as a child, the two protected one another, were close friends, and fought together throughout the clone wars. "You were my Brother Anakin."
Love absolutely is allowed. For a start if you think Yoda doesn't love the younglings he teaches then I've got a bridge to sell you.
Obi-Wan, throughout his life held a deep admiration and respect for Duchess Satine, he loved her.
But for the two of them, their duties come first. Her as a leader of her people, him as a jedi. Both have responsibilities, that neither are willing to set aside or compromise. Or, at least that Duchess Satine isn't willing to allow distractions from her work. Paraphrased Obi-Wan tells her. "If you had asked I would have left the Jedi order for you." But she never asks, and so he stays a Jedi, and despite their feelings for one another maintain a professional work ethic.
And it's that simple. As a jedi your duties should come first. But being a jedi is a choice. If you don't wish to be a jedi. It's as simple as leaving. Ahsoka did it.
The confusion people often have, is that the Jedi order only trains jedi in the ways of the force. And for good reason, they don't want to train people with force powers who might misuse them, they see using the force as something to be done responsibly, and not for personal gain. And, because on of the orders duties is to protect the republic and to watch against sith, or dark jedi. They often keep tabs on those who leave the order. To try and make sure for example that Count Dooku doesn't use his abilities to set himself up as a warlord.
He can act as a political idealist, outside of the jedi. But he cannot use his training as a rebel.
Really simply, the order doesn't want to train someone who will use their powers selfishly, since the whole core concept of the jedi, is them being guardians of the peace and servants of the people.
And Obi-Wan, in my mind, did everything right. Yes, he loved Duchess Satine, but he never let his feelings for her get in the way of his job. If he wants to be with her, he can, if he wants to be a jedi and serve the people he can. But under the orders rules he's not allowed to do both since one compromises the other.
In a hypothetical scenario, Obi-wan marries Satine, but stays in the order, and a young jedi is sent to mediate a trade dispute between Mandalore and another planet. Can the younger Jedi really be expected to be truly impartial when a master Jedi has a close relationship with one of the planets rulers?
It's theoretically possible that Kenobi marries her and stays impartial. But it's much more difficult.
And beyond that, the Jedi very specifically wanted to not be the kind of order that was ran by familial dynasties of those strong in the force. Which is another reason the order forbids marriage. The Shan family, descendants of Revan being particularly strong in the force and Satele Shan rising to the rank of grand master.
So Obi-Wan, despite his love for Satine, remained a Jedi and did his duty. And, despite his love for Anakin, when it was required of him, he did his duty to the order.
Anakin, on the other hand, did Not do his duty as a jedi.
He was a hero throughout the clone wars, doing his duty, despite his relationship with Padme. And that's well enough.
But near the end, he abandoned his duty, to act selfishly to try and protect Padme, and betrayed the order. And that's the problem.