Setup: Place a rail. Place a minecart on that rail. Place a shulker egg next to the minecart so it goes into it. Break the minecart by punching it a bunch. Done! You can see the rail is still there when the shulker looks out of its shell.
Hopper minecarts, chest minecarts, minecarts with mobs in them, & furnace minecarts can go through the shulker. Not normal, empty minecarts because they put the shulker into it.
Can confirm in 1.18.2. Rail is within the shulker upon removing the minecart (see screenshot). Furthermore, other minecarts that are not empty can pass through the shulker if pushed (if on non powered rails).