Have a look at the excelent tutorial on how to do VLANs on Routeros, in particular Router on a Stick section.
Switch has to be configured appropriately as well. If fiber modem works as untagged device, then configure switch port connecting it with “default vlan id” (or PVID) so that switch taes care of tagging/untagging WAN traffic. Etc.