There are a few things you could try:
The first is place a magnet over the sensor so its always engaged. That will require you to use the external monitor all of the time.
Replacing the sensor will require finding the sensor from another MacBook Pro as it’s a custom part.
As far as replacing it does require a bit of skill. Maybe you should find someone with the skills and the part to fix it for you.