Yes, there is the uci-default system where you build the image with this file in a folder.
There is one thing to keep in mind though when using uci-defaults since that comes with no turning back once initiated. If you have a system failure fault in the script you are in trouble because you can never get a working system (maybe not even a way to connect to the router without serial) what ever you do.
If you instead install a default image and run a script with a fault you can simply reset and redo.
But if you want to use uci-defaults it is probably simpler to just use the config files right away instead of using a script run by uci-defaults at first boot.
The only thing I use uci-default to is make really basic settings at first boot like timezone which is really nice but it isn’t a dealbreaker.
When I had the realtek switch I also used to set it to dhcp client and set up a tagged vlan at first boot so I at least was able to connect to it to run the big setup script.
And if you want any extra packages these need to be installed at build time or at least before running the script if the script have commands for those extra packages.