Fix SVG insertBefore/insertAfter when wrapped in <a> when setting "href"

When an element has an "href" the node is wrapped with an `<a>`. `insertBefore`/`insertAfter` did not take this into account (#631). Additionally, `remove`, `toFront` and `toBack` now use the new function (reducing code duplication and size).