Team A will always win.
Whoever grabs the last flag wins, and you need to be able to get there within 3 steps. If Team A lands on the 5th to last flag, then Team B will be just out of reach of the last flag, and if they move even one step, Team A will be able to win. Effectively, whoever lands on the 5th to last flag wins. We can continue this logic backwards, where each flag 4 spots down is a "victory" flag.
The first victory flag is the very first flag in the sequence, and since Team A always goes first, they'll be able to grab that flag. They must only grab that flag, however, otherwise Team B will be able to pick up the next victory flag. To secure each victory flag from there, Team A must choose a number of flags such that the total flags removed within one turn cycle is 4. So if Team B picks 1, 2, or 3, Team A picks 3, 2, or 1 respectively.
Would be curious to know how this problem might be solved more analytically.