Macbook Pro 2018, trackpad issue because of swollen battery or faulty trackpad?

We can only speculate wether the issue is caused by the swollen battery.

HOWEVER

A swollen battery can be a hazard and should be swapped either way. Apple offers extra warranty for batteries that are swollen (2-3 years from purchase depending on the device). An AASP (Apple Authorized Service Provider) should be able to swap the Top Case (which will include the battery as well as the trackpad) under the extended warranty free of charge.