Why not just use/pick the tagged ID that the user enters as the deviceId? I do understand the silly naming convention but coming from the networking and coding side you never want to use something and call it something else.
https://github.com/opnsense/core/commit/64fb551caa35f83f2c8d47d43d5544cb7590ace6
# ifconfig vlan createvlan0Nope
vlans_lagg0="1 2 3 4"