Why do we need to create VLANs to break a broadcast domain when the router can do the same?
VLANs will let a single switch act as if it was a several switches. A router is required to allow traffic to get from one VLAN to another VLAN.
Routers typically have few physical interfaces (router interfaces are expensive compared to switch interfaces), so it may be impractical to use router physical interfaces to break your network into multiple physical LANs. Most business-grade routers will let you create multiple virtual interfaces on a single physical interface. Each virtual interface will be a separate VLAN, and you use 802.1Q tagging to separate the traffic for each VLAN.
Example of a router on a stick (using your own diagrams):