Yes you can apply to all three things.
When you make your rank list, your "primary" rank list will consist of programs in your chosen specialty, Anesthesiology. Regardless of whether they are categorical or advanced, you will simply rank them in order of your preference.
You will also be applying for prelim medicine/transitional year programs so that, should you match into an advanced Anesthesiology spot (rather than categorical), the match algorithm can then place you into a first year position. It does this by utilizing a "secondary" rank list of your prelim/TY programs that are contingent on your Anesthesiology choices.
For each advanced Anesthesiology program on your match list, it will require you to attach a secondary list for your prelim spots. For example, your number 1 program may be advanced; you would attach a specific prelim rank list to that one program such that, should you match at your number 1 Anesthesiology program, the match then uses that supplemental/secondary list to find you your prelim spot. You may use the same secondary list for every single advanced program, or you can tailor them to your own needs. For instance (and I have no idea which programs are advanced/categorical, I'm just making something up) if you ranked Mass General advanced #1, your secondary list may consist mostly of Boston area prelim programs. If UCLA advanced is your #2, your secondary list for UCLA may then include a bunch of California prelim programs. It's totally up to you. If Mayo Clinic categorical is your #3, you will not have an option to attach a secondary list since it is categorical and does not require one.
The only way you can match into your home program's Prelim medicine program without matching into the advanced Anesthesiology program (or any other advanced Anesthesiology program) is if you include the Prelim medicine program on your primary rank list. People generally only do that if they are worried about matching at all, usually in a competitive specialty, and would rather match SOMETHING (even a 1 year program) than not match at all.
Does this at least make some sense the way I'm explaining it?