This was originally going to be a comment as I'm not 100% sure everything comes together to use it like this. I only use GPS - I've bought a (too-) cheap cadence sensor but it's not working yet. With a Bluetooth or ANT+ speed or cadence sensor on your bike, the Android app I use can automatically identify your bike. There's an auto start feature but I haven't tested it - presumably it has to be left running. It's called IPbike, and you can try it for free for plenty long enough to get the hang of it (and not expensive if you want to keep it). You can still have strava etc. uploads if you want. And you can get everything out as a GPX file or various other formats. There might be more information online - I've had a few questions about other features and always found an answer. Unlike strava or the other major tracking apps, you keep control of your own data.
The other (expensive) option might be a multisports watch. They can apparently detect what you're doing (for example to switch between triathlon segments). Some phone apps say the same, and you could then look at only the bike segments. But it all comes down to the data export. GPX is a good interchange format, so if you find that a product (app or watch) can export a GPX file per segment, you're probably in luck.