Here's my attempt at a fastest route, without constraints:
Goal 01: [ ] Yoshi's Island 1
Goal 05: [ ] Yellow Switch Place
Goal 02: [ ] Yoshi's Island 2
Goal 03: [ ] Yoshi's Island 3
Goal 04: [ ] Yoshi's Island 4
Goal 06: [ ] Castle #1: Iggy's Place
Goal 07: [ ] Donut Plains 1
Goal 10: [ ] Donut Plains 2 Secret Goal
Goal 11: [ ] Green Switch Place
1 Goal 09: [ ] Donut Plains 2
Goal 13: [ ] Donut Ghost House Secret Goal
3 Goal 08: [ ] Donut Plains 1 Secret Goal
Goal 17: [ ] Donut Secret 1 Secret Goal
Goal 19: [ ] Donut Secret House Secret Goal
2 Goal 80: [ ] Star Road 1 Secret Goal
1 Goal 82: [ ] Star Road 2 Secret Goal
1 Goal 84: [ ] Star Road 3 Secret Goal
1 Goal 86: [ ] Star Road 4 Secret Goal
1 Goal 87: [ ] Star Road 5
2 Goal 18: [ ] Donut Secret House
2 Goal 20: [ ] Donut Secret 2
2 Goal 14: [ ] Donut Plains 3
Goal 15: [ ] Donut Plains 4
Goal 21: [ ] Castle #2: Morton's Place
Goal 22: [ ] Vanilla Dome 1
Goal 25: [ ] Vanilla Dome 2 Secret Goal
Goal 26: [ ] Red Switch Place
1 Goal 24: [ ] Vanilla Dome 2
Goal 27: [ ] Vanilla Ghost House
Goal 28: [ ] Vanilla Dome 3
Goal 29: [ ] Vanilla Dome 4
Goal 35: [ ] Castle #3: Lemmy's Place
1 Goal 36: [ ] Cheese Bridge
Goal 39: [ ] Cookie Mountain
2 Goal 37: [ ] Cheese Bridge Secret Goal
Goal 38: [ ] Soda Lake
4 Goal 85: [ ] Star Road 4
1 Goal 83: [ ] Star Road 3
1 Goal 81: [ ] Star Road 2
1 Goal 79: [ ] Star Road 1
3 Goal 16: [ ] Donut Secret 1
Goal 12: [ ] Donut Ghost House
3 Goal 23: [ ] Vanilla Dome 1 Secret Goal
Goal 31: [ ] Vanilla Secret 1 Secret Goal
1 Goal 30: [ ] Vanilla Secret 1
Goal 32: [ ] Vanilla Secret 2
Goal 33: [ ] Vanilla Secret 3
Goal 34: [ ] Vanilla Fortress
Goal 40: [ ] Butter Bridge 1
Goal 41: [ ] Butter Bridge 2
Goal 42: [ ] Castle #4: Ludwig's Castle
Goal 43: [ ] Forest Of Illusions 1
Goal 46: [ ] Forest Of Illusions 2 Secret Goal
Goal 51: [ ] Blue Switch Place
1 Goal 45: [ ] Forest Of Illusions 2
Goal 47: [ ] Forest Of Illusions 3
Goal 53: [ ] Forest Ghost House Secret Goal
Goal 44: [ ] Forest Of Illusions 1 Secret Goal
Goal 52: [ ] Forest Ghost House
Goal 50: [ ] Forest Of Illusions 4 Secret Goal
Goal 54: [ ] Forest Secret Area
Goal 55: [ ] Forest Fortress
3 Goal 49: [ ] Forest Of Illusions 4
1 Goal 48: [ ] Forest Of Illusions 3 Secret Goal
Goal 56: [ ] Castle #5: Roy's Castle
Goal 57: [ ] Chocolate Island 1
Goal 58: [ ] Chocolate Ghost House
Goal 60: [ ] Chocolate Island 2 Secret Goal
2 Goal 66: [ ] Chocolate Secret Area
4 Goal 59: [ ] Chocolate Island 2
Goal 61: [ ] Chocolate Island 3
Goal 62: [ ] Chocolate Island 3 Secret Goal
Goal 63: [ ] Chocolate Fortress
Goal 64: [ ] Chocolate Island 4
Goal 65: [ ] Chocolate Island 5
Goal 67: [ ] Castle #6: Wendy's Castle
Goal 68: [ ] Sunken Ghost Ship
Goal 69: [ ] Valley Of Bowser 1
Goal 71: [ ] Valley Of Bowser 2 Secret Goal
Goal 77: [ ] Valley Fortress
2 Goal 70: [ ] Valley Of Bowser 2
Goal 73: [ ] Valley Ghost House Secret Goal
1 Goal 72: [ ] Valley Ghost House
Goal 74: [ ] Valley Of Bowser 3
Goal 76: [ ] Valley Of Bowser 4 Secret Goal
1 Goal 75: [ ] Valley Of Bowser 4
Goal 78: [ ] Castle #7: Larry's Place
3 Goal 88: [ ] Star Road 5 Secret Goal
2 Goal 89: [ ] Gnarly
Goal 90: [ ] Tubular
Goal 91: [ ] Way Cool
Goal 92: [ ] Awesome
Goal 93: [ ] Mondo
Goal 94: [ ] Groovy
Goal 95: [ ] Outrageous
Goal 96: [ ] Funky
Total=53, including 4 pipes (3 required) and 6 stars (2 required, but mutually exclusive of only using 3 pipes)
The "goal numbers" represent the order they were written (taken from StarFighters76's FAQ on GameFAQs). The Numbers on the left roughly represent the number of "movements" it takes to get to the given level, from the point where the last level puts you. So for instance, to beat Donut Plains 2 the normal way, you need to move once from the Green Switch Palace. Note that most levels require no movement, since beating the previous level will place you right on the next level. I count using a Pipe (such as the one to get to Donut Secret 2) as one move, then moving off the pipe as one other move.
This is (I think) the shortest route in terms of movements, however it may not be if you count other factors, such as:
1. This route assumes you have no intention of beating Bowser, as it ends on Funky, which leaves a bit of a trek to Bowser. If beating Bowser is a requirement, that may change the route.
2. Is hitting or not hitting some of the Switch Palaces a requirement for faster completion of certain levels? If so, that would affect when the switch palaces are obtained. The order above assumes that hitting the switch palaces bears no effect. Even if it makes a level take slightly longer however, it may still be worthwhile to use this order if it still saves overworld movement time.
3. Availability of powerups - i.e., are there certain levels where it would be faster to complete as Fire mario, but no flowers are available in the level? I don't think this is the case. I assume that the optimal use of powerups is to get a cape ASAP and keep it for the rest of the game, except where it may be to your advantage to take damage to save time.
4. The last assumtion is that all "movements" on the overworld, including pipe and star movement, take the same amount of time, which is clearly not the case. However, I've minimized movements which I think take the most time, such as from Soda Lake to Star Road 3 and such.