Recently I've learned that to prevent a "bloated" stomach, you should
contract the transverse abdominis when exercising.
Not exactly...
You shouldn't try to activate (in isolation) transverse abdominis (TVA) directly while doing anything but direct TVA work.
Sucking in like that while trying to do squats, or lunges or deadlifts or bench press, or chin-ups or anything like that is a bad idea.
I won't get into why. Instead, I'll just link to a video by Dr. Stuart McGill (basically the world's foremost authority on back pain and the spine) on why you should brace instead of sucking the abdominals in. In short, bracing protects your spine, sucking in destabilizes the spine and increases injury potential if you're actually trying to train exercises under load.
If you're chasing prevention of a bloated look and you're trying to train TVA directly, you should train it directly either on all fours (quadruped position) or on your back (likely in a deadbug position).
However, I can't figure out if I'm actually doing the contraction
properly. Is there any sure-fire way to feel that contraction and know
that it's the transverse abdominis and not just a slight contraction
of the rectus abdominis?
Yes, lay on your back and find the insides of your pelvic bone relatively low down. Near your crotch almost. Put your index finger and middle finger just inside the fleshy part of the pelvis. And try to vacuum in (suck in) or pull the belly button towards your spine. It's almost like kegels too (as your pelvic floor works in co-contraction with your TVA), so it will also kind of feel like you're trying not to pee.
Ultimately you should feel the contraction with your fingers, essentially behind the the Rectus Abdominis (RA, the 6 pack muscle). You should be able to feel a strong/firm contraction behind them without much activation of them, but you likely won't be able to do TVA direct work without some RA activation. They typically work together to a degree.
This is a good awareness drill before you do any other TVA focused training like vacuums or deadbugs.
All that being said, frankly I find TVA specific training outdated and overrated. I still use it from time to time, on occasion. Maybe something to revisit periodically. However, the research a lot of that TVA stuff from the 2000's was based on some faulty logic. It found that TVA was delayed in it's contraction in low back pain patients, but it was more likely that the TVA was delayed due to back pain and not the back pain being caused by the TVA being delayed.
If you are doing it, it shouldn't be much. Once you get the hang of the feeling and that fine motor control, you can likely move onto other things and drop TVA work entirely from your routine. Maybe revisit it once or twice a year, see if you still have the motor control.