honestly there needs to be a mod that allows for server-made GUIs to be shared to clients (securely, of course)
one of the pitfalls of having an engine that lets you so readily create and run code is that it makes things like this pretty difficult to secure and moderate
the closest thing you could get is a platform like RTB or blockland glass that would let server owners put up a mod and say "hey!! please download my client mod through this trusted, quality-controlled service." when a player joins (obviously an optional thing because autonomously downloading strange files to a player's computer is not something you want to do), similarly to how minecraft does (used to do? not sure if it's still a thing) with its server texture packs, albeit the way that works is a lot less secure because you literally just put in a URL for the file you want to download
it's not great, but it's leagues better than giving server owners the ability to send foreign code to a client for them to run, and the only security measures you could put in place would be to make things so incredibly restrictive that nobody would want to use the system anyway