I use this script with ViolentMonkey.
Lemmy Support
Support / questions about Lemmy.
I think a better request is to get your client to show you just the communities from a particular instance in your feed, rather than actually switching instances to browse.
I use the liftoff app, which automatically asks if I want to switch instance when I try to upvote something elsewhere. If it's not on my home instance, I go back and subscribe, problem fixed.
There is a lot of those quirkinesses IMO, also like browse another instances communities (only) and subscribe to those you like, mannually possible but a hassle today.
I think third party apps (and the official Jerboa + web client if they want to) could handle those kind of things, I don't think Lemmy (core Lemmy API) needs any modifications for this to work.
An app could have the "explore all local communities of " (a right click burger menu, or an icon for example on any server name) and when in this "explore all local communities from this single instance" space, let you sub etc.
Not exactly what you asked for, but it's all in the same vein; UX/UI stuff. Every app can do their way too, to check out what's nice and easy for their users.
IMO anyways.
.
Shitty formatting: on mobile
A few days late, but this is actually something I've been working on for Instance Assistant! I implemented a first attempt and released it this weekend. Let me know if it works for you :)
It should pop up in the sidebar of any post on a foreign instance. If it doesn't load, you may need to refresh the page. That's something I'm still working on because redirecting on a Lemmy site isn't always detected as navigating to a new page.