Taiwan is completely different from Ukraine culturally, and I don't think simply blanket arming people is a solution there either. Big difference being that the Ukrainian standard of living, even under Zelensky has been bad. If you are simply surviving, taking up arms is a much easier sell. If you are comfortable and well off, you have a lot more to lose. If Xi is smart, which he is- he will attempt to take over Taiwan via political means. I don't think he will attempt to repeat the Hong Kong approach with an entire country, when he already has pro Chinese political entities within Taiwan.
> teach them that killing invaders is the only way to keep their freedom and not fall under the totalitarian
First you need to convince people that the value of freedom is actually worth the cost. Based on what I've seen for the past two years, many people do not value freedom, even in the United States. They'd rather be comfortable than free. The cost of freedom is often everything for those that actually choose it. The benefits are only realized by the next generation.