"This was introduced in the early Middle Ages, with the ban extending up to sixth cousins by the 11th century."
That was true - in theory. In reality it was often ignored.
For example, when Eleanor of Aquitaine (later wife of King Henry II) married King Louis VII of France in 1137 they were related within four degrees; they were third cousins once removed. The common ancestor was King Robert II of France.
There was no problem at all with them getting married until Louis decided he wanted a male heir. He then got a divorce from Eleanor on the grounds that the marriage shouldn't have been allowed in the first place.
Louis then married a second time and again there was no male heir, but a third marriage did produce a male heir.
So, there was no problem getting married, this was just used as an excuse to get an annulment to the marriage. In fact Louis first tried to get his marriage annulled in 1149 but the Pope turned him down. It was only in 1152 when he tried a second time that the annulment was granted.
.
"The ban was ended in the early modern period."
This was all down to Henry VIII. First there was the Act of Succession 1533 which said that marriages that were prohibited in the bible (Leviticus) were illegal.
Then came the Marriage Act 1540 which said that any marriage that was allowed by the bible was lawful and that the church could not ban other marriages. So this is when the church stopped being allowed to ban cousin marriages in England.