Do the yellow and green switches look like this on your game? If so, then you should be able to enter them. If they appear crushed, then that means you've already activated it and cannot enter it ever again.

There's obviously a glitch in your game then. And no, they don't activate on their own - you have to stomp on the switch and all blocks of that color will become solid. The only thing I could think of is that somebody played your file and activated the switches themselves. Try starting a new game and see if that works.

Switches and castles are restricted from replays in SMW. However, if you press L+R, you will re-enter a selected castle/fort anyways. However, switch palaces are only able to be played once per game, as unlike the castles, the switch palaces would be an easy way to get 1-ups.