Trying to replace the stuff behind a bathroom knob, nothing was as expected from how-to's. Here's what we pulled out. What do we replace it with?
@Kris said nearly, precisely what I had planned to say. I'll break my answer down into 2 parts, as that is how you asked your question.
A. What is it and how to get a replacement part?
It does appear to be a shower valve cartridge. It will be helpful to have the following information on hand when you go to get help with the replacement part.

Have pictures of the valve assembly handy to share; multiple angles, which might actually present a mfg's name
Have the cartridge and any trim you pulled off; often times the brand can be easily determined by the trim
The easiest place to start might be a big box store like Lowes, HD, etc.
A plumbing supply wholesaler can almost assuredly tell you without hardly blinking an eye. Just realize you cannot purchase anything if your not a business owner, contractor, or of the like

B. Why is there a slow trickle when the main is shut off?
Over time sediment buildup is common place from each time the city supply lines are worked on. This can cause a poor seal or scratches the rubber seat and prevents a complete seal from ever occurring. This is common and it happens because we are not in the habit of operating these valves regularly like we do a water faucet, nor would I really suggest doing it. You'd probably experience the same behavior if you've ever turned off a toilet or faucet supply valve to replace a supply line; near impossible to stop them from exhibiting a slow drip. Here are some steps you can take to fix the issue.

Shut the water off at the city junction (where the underground water meter is) and, if the valve type is like a hose bib and takes several turns to turn on/off, unscrew the handle assembly; the hex nut at the base of the stem beneath the handle. If it's a 90 degree ball valve, then there's something else wrong and would probably just replace the entire valve
Replace the seat gasket and reassemble

When turning the water back on from meter to house, make sure the home supply valve is in off position and turn the water back on about 1/8 turn per ~10-15 seconds. This will prevent shocking the system with a bunch of water pressure that hits a wall and causes pipe and joint ruptures.
For the house supply valve, put the shower valve back together and leave the trim off so you can verify no leaks at the repair site. Turn on a nearby sink to prevent a water surge to the system that would cause pipe and joint rupture; same as previously mentioned. Also turn the water on slowly, same as before. Then turn the sink off and check for leaks at the repair site. If no leaks, turn on all the faucets in the house to purge air and debris. Once the system is completely burped at each faucet, turn each one off and put the trim back on the shower valve. Congratulations, you finished repairing your shower valve!