How to make a self-recognition socket for diferent connectors (sensors)
You could use an analog method of resistance or voltage  to determine the sensor, but that requires an extra pin per sensor, plus a way to communicate that back to the RPI.

Instead, look at i2c sensors. Each sensor would have a unique address and the RPI can scan for these sensors using the LM-sensor or i2c-tools package.

Of course, you want to mix and match how these sensors are wired so a custom solution by you is require. You already have the basic idea down.