The only way you can do what you want is to turn off iMessage in each device that uses the same AppleID, where you do not wish it to receive iMessages associated with the AppleID.
I too share my AppleID with my family, but I share it so that there is a singular iTunes account where all devices can access the apps and music purchased on the shared account. (Family share does not work well).
The trick is have multiple AppleIDs. Dedicate one to iTunes, but then provide one for each user for iCloud. I don't want messages, photos, and other iCloud connected items to be shared, so the shared AppleID is used ONLY for iTunes. For iCloud uses, each person has their own AppleID, that they use for iCloud purposes. These family members do not use their own iCloud accounts for iTunes.
iTunes AppleID: all devices log into iTunes using this AppleID
Personal AppleID: each device is logged into iCloud using a personal AppleID.