The javascript doesn't use the context variable and thus I run into problems when i have the node level blocks module enabled as every time i drag a block an extra relatedlink field is added.

I solved it by changing the js into this:

(function ($) {

Drupal.behaviors.relatedlinks = {
  attach: function(context, settings) {

  var autocomplete_path = Drupal.settings.relatedlinks_autocomplete[0];
  // Strip relatedlinks/autocomplete from the path.
  var path_prefix = autocomplete_path.substring(0, autocomplete_path.length - 25);

  // Trigger Drupal's autocomplete.
  Drupal.behaviors.autocomplete;

  var ta = $('#edit-relatedlinks-fieldset-relatedlinks', context);

So now it properly uses context