In general you should use only source mode and reading mode when writing math formulas. Have you tried restarting Obsidian and then toggle source mode? Send a screenshot of your source mode if the problem persists so we may be able to reproduce your problem. You can also set default editing mode as source in Options, Editor, Default editing mode.
When using the aligned environment in LaTeX/mathjax, you should use the & symbol somewhere you want lines to be vertically aligned on. The snippet below should work now in reading mode.