Which Thunderbolt dock should I buy for MacBook Pro13 late 2011, running High Sierra 10.13.6
Starting off, it’s important to know that any Thunderbolt dock that you get will be obsolete by about five years (at the time of this writing).

You need a Thunderbolt 1 or Thunderbolt 2 dock.  They will support your requirements of plugging in your peripheral devices; hard drives, keyboards, mice, etc.  You may need an adapter for your MIDI interface, but it will be no different than needing the same adapter to connect directly to your Mac.

Thunderbolt is backward compatible meaning that it will connect to older Thunderbolt devices.  However, going from a new Thunderbolt 3 port to older Thunderbolt 1 or 2 port, will require an adapter due to the differences in needing an active (powered) cable versus a passive cable.

Do I recommend you going this route?  No!

This is a nearly decade old Mac with all obsolete tech and by your own admission, the ports are becoming “unstable”, likely from being  worn and the connections getting loose.  You’re throwing good money at something that will simply only get worse - you’d be buying already discontinued and obsolete tech (if you can actually source it).  Your better bet is to get a more modern Mac with reliable ports and support for new(er) operating systems.