This is a common yet interesting case.
There is no short answer to this question. There are some 'parameters' missing (like current decisions made or the frequency of ingesting). I will try to give a number of approaches you could consider.
First, you have an IoT Gateway, connected to the cloud. It seems to be registered as an IoT Device.
Azure IoT also supports the concept of IoT Edge devices. Here adding custom logic on the edge is easy to send custom messages. It also supports the concept of Identity Translation where multiple IoT device registrations are handled by one edge device.
Due to the requirements of the IoT Edge runtime (e.g., running Docker containers), this means introducing a new device (e.g., raspberry pi or Industrial pc) between IoT Gateway and Cloud (An IoT Edge Gateway).
The other solution is splitting the incoming messages AFTER the IoT Hub.
The IoTHub has functionality for routing messages to different endpoints (other Azure resources) and it can enrich messages with static values (like device tags with make or type or customer).
Splitting is usually done with:
Azure Stream Analytics
An Azure function
The output of these pieces of logic is then sent to some 'message bus' like a message Event Hub where other services can pick up the flow or some persisted storage is filled with the new messages.
Azure Function is interesting in the consumption plan with a large number of free messages handled being handled.
Azure Stream Analytics is very flexible. If you are familiar with TSQL, this is a great way to handle data in flight.
There is no free tier for Azure Stream Analytics, though.
So it depends on the number of messages being sent to the cloud.
Keep in mind the IoT hub ingest is actually measures in chunks. So the message sent can not grow without consequences.
This can be compensated with inflating messages (are you in control of the logic running on that IoT Gateway?) which is automatically deflated on the IoT hub input (See the event compression type).
Still, scaling up the IoTHub is likely a cheaper way than adding that extra logic.
Conclusion: There are more angles to this story, but for now, if you are able to switch to an IoT Edge device with the open-source IoT Edge runtime, you do not need to pay for the logic running in the cloud.
I recommend checking out the MS Learn training material about Azure IoT (Edge).