Anyway, if anyone is interested in the solution to the actual topic of this thread, it has to do with the little-known stream property called "orientation". It starts out unset and becomes either "narrow" or "wide" after the first use of the stream. The only way to reset it is to close and reopen the stream.
Code:
#include <iostream>
#include <clocale>
 
int main() {
  setlocale(LC_ALL, "en_US.utf8");
 
  std::cout << "hello\n"; // stdout is now narrow
  std::wcout << L"ฐ\n";   // so this will not print
 
  std::wcerr << L"\nฐ\n"; // stderr is now wide
  std::cerr << "hello\n"; // so this will not print
 
  // closing and reopening a stream will unset it's orientation
  freopen("/dev/stdout", "w", stdout); // this is for linux
  std::wcout << L"\nฐ\n"; // stdout is now wide
  std::cout << "hello\n"; // so this will not print
}