How to have Safari open links with the evil target attribute open in the same tab?
Install the Safari extension LinkThing to customize links behavior. It should be able to solve your problem, additionally, you can also customize the onsite and offsite links behavior.