I would prefer my current solution, but I would like to be sure that my example (the one in my e-mail dated Fri, 3 Jan 2025 13:53:32 +0100) is correct. I still am not sure about that.
If it does what you want and it is only ever executed by application code over a client connection you should be fine. Your client connection will always have whatever search_path you arrange to have in place and the application developer will know whether their environment is correct or not when they test it, and have the ability to change their environment as needed.